summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/Vector2Range.cs
blob: af83d56e55956c0dd72c80e6214ce32225011dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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);
	}
}