コード例 #1
0
        /// <summary>
        /// Set new range and calculate inclusive bounds.
        /// </summary>
        /// <param name="newRange">New range value</param>
        public void SetData(Vector2 newRange)
        {
            range = ClampNewRangeValues(newRange);

            isXInclusive = range.x == 0 || FloatHelper.CheckIfProvidedFloatsAreEqual(1f, range.x);

            isYInclusive = true;
        }
コード例 #2
0
        /// <summary>
        /// Checks is value positioned in current range.
        /// </summary>
        /// <param name="value">Value to check.</param>
        /// <returns></returns>
        public bool CheckIfValueInRange(float value)
        {
            if (isXInclusive && FloatHelper.CheckIfProvidedFloatsAreEqual(value, range.x))
            {
                return(true);
            }

            if (isYInclusive && FloatHelper.CheckIfProvidedFloatsAreEqual(value, range.y))
            {
                return(true);
            }

            return(value > range.x && value < range.y);
        }
コード例 #3
0
 public static bool operator !=(RangeChancesUnit <T> item1, RangeChancesUnit <T> item2)
 {
     return(!(item1.UnitRange == item2.UnitRange || FloatHelper.CheckIfProvidedFloatsAreEqual(item1.ChanceRawForm, item2.ChanceRawForm)));
 }