diff options
Diffstat (limited to 'Client/Assembly-CSharp/Vector2Range.cs')
-rw-r--r-- | Client/Assembly-CSharp/Vector2Range.cs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/Vector2Range.cs b/Client/Assembly-CSharp/Vector2Range.cs new file mode 100644 index 0000000..af83d56 --- /dev/null +++ b/Client/Assembly-CSharp/Vector2Range.cs @@ -0,0 +1,55 @@ +using System; +using UnityEngine; + +[Serializable] +public struct Vector2Range +{ + public float Width + { + get + { + return this.max.x - this.min.x; + } + } + + public float Height + { + get + { + return this.max.y - this.min.y; + } + } + + public Vector2 min; + + public Vector2 max; + + public Vector2Range(Vector2 min, Vector2 max) + { + this.min = min; + this.max = max; + } + + public void LerpUnclamped(ref Vector3 output, float t, float z) + { + output.Set(Mathf.LerpUnclamped(this.min.x, this.max.x, t), Mathf.LerpUnclamped(this.min.y, this.max.y, t), z); + } + + public void Lerp(ref Vector3 output, float t, float z) + { + output.Set(Mathf.Lerp(this.min.x, this.max.x, t), Mathf.Lerp(this.min.y, this.max.y, t), z); + } + + public Vector2 Next() + { + return new Vector2(UnityEngine.Random.Range(this.min.x, this.max.x), UnityEngine.Random.Range(this.min.y, this.max.y)); + } + + public static Vector2 NextEdge() + { + float f = 6.2831855f * UnityEngine.Random.value; + float x = Mathf.Cos(f); + float y = Mathf.Sin(f); + return new Vector2(x, y); + } +} |