public static Vector2 InsideRange2(this Random random, Range2 range2)
 {
     return new Vector2(
         random.Range(range2.x.min, range2.x.max),
         random.Range(range2.y.min, range2.y.max));
 }
Example #2
0
 /// <summary>
 /// 获取两个范围的交集
 /// </summary>
 public Range2 GetIntersection(Range2 other)
 {
     other.x = x.GetIntersection(other.x);
     other.y = y.GetIntersection(other.y);
     return other;
 }
Example #3
0
 /// <summary>
 /// 扩展以包含指定范围
 /// </summary>
 public void Encapsulate(Range2 other)
 {
     x.Encapsulate(other.x);
     y.Encapsulate(other.y);
 }
Example #4
0
 /// <summary>
 /// 判断是否与另一范围有交集
 /// </summary>
 public bool Intersects(Range2 other)
 {
     return x.Intersects(other.x) && y.Intersects(other.y);
 }