コード例 #1
0
ファイル: Range.cs プロジェクト: Kotvitskiy/AoS
 /// <summary>
 /// Test if this Range overlaps another Range.
 /// </summary>
 /// <param name="r">The Range to test against.</param>
 /// <returns>True if the ranges overlap.</returns>
 public bool Overlap(Range r)
 {
     if (Min >= r.Min && Min <= r.Max) return true;
     if (Max <= r.Max && Max >= r.Min) return true;
     return false;
 }
コード例 #2
0
 /// <summary>
 /// Generate a random float.
 /// </summary>
 /// <param name="range">A Range that will set the minimum and maximum.</param>
 /// <returns>A random float.</returns>
 public static float Float(Range range)
 {
     return(range.Min + (range.Max - range.Min) * Value);
 }