コード例 #1
0
 /// <summary>
 /// Point between Min and Max
 /// </summary>
 public static int MidPoint(this MinMaxInt minMax)
 {
     return(minMax.Min + minMax.Length() / 2);
 }
コード例 #2
0
 /// <summary>
 /// Distance from Min to Max
 /// </summary>
 public static int Length(this MinMaxInt minMax)
 {
     return(minMax.Max - minMax.Min);
 }
コード例 #3
0
 /// <summary>
 /// Lerp from Min to Max
 /// </summary>
 public static float RandomInRange(this MinMaxInt minMax)
 {
     return(Random.Range(minMax.Min, minMax.Max));
 }
コード例 #4
0
 /// <summary>
 /// Clamp value between MinMax values
 /// </summary>
 public static int Clamp(this MinMaxInt minMax, int value)
 {
     return(Mathf.Clamp(value, minMax.Min, minMax.Max));
 }
コード例 #5
0
 /// <summary>
 /// Lerp from Min to Max
 /// </summary>
 public static float LerpUnclamped(this MinMaxInt minMax, float value)
 {
     return(Mathf.LerpUnclamped(minMax.Min, minMax.Max, value));
 }