diff options
Diffstat (limited to 'YesCommander/Assets/Scripts/Utils/MathUtils.cs')
-rw-r--r-- | YesCommander/Assets/Scripts/Utils/MathUtils.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/YesCommander/Assets/Scripts/Utils/MathUtils.cs b/YesCommander/Assets/Scripts/Utils/MathUtils.cs new file mode 100644 index 0000000..a221adc --- /dev/null +++ b/YesCommander/Assets/Scripts/Utils/MathUtils.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +namespace YC +{ + + public static class MathUtils + { + + public static Vector2 Abs(Vector2 v) + { + return new Vector2(Mathf.Abs(v.x), Mathf.Abs(v.y)); + } + + public static Vector2 Max(Vector2 src, float v) + { + return new Vector2(Mathf.Max(src.x, v), Mathf.Max(src.y, v)); + } + + public static void Swap(ref float f1, ref float f2) + { + float t = f1; + f1 = f2; + f2 = t; + } + + } +} |