Esempio n. 1
0
    public bool IsBetween(ClusingType type, float value)
    {
        switch (type)
        {
        case ClusingType.EE:
            return(IsBetweenEE(value));

        case ClusingType.EI:
            return(IsBetweenEI(value));

        case ClusingType.IE:
            return(IsBetweenIE(value));

        case ClusingType.II:
            return(IsBetweenII(value));
        }
        return(default(bool));
    }
    /// <summary>
    /// Returns true if the value is between the two boundaries
    /// </summary>
    /// <param name="value"></param>
    /// <param name="lower"></param>
    /// <param name="greater"></param>
    /// <returns></returns>
    public static bool isBetween(this float value, float lower, float greater, ClusingType clusing)
    {
        switch (clusing)
        {
        case ClusingType.EE:
            if (value > lower && value < greater)
            {
                return(true);
            }
            return(false);

        case ClusingType.II:
            if (value >= lower && value <= greater)
            {
                return(true);
            }
            return(false);

        case ClusingType.EI:
            if (value > lower && value <= greater)
            {
                return(true);
            }
            return(false);

        case ClusingType.IE:
            if (value >= lower && value < greater)
            {
                return(true);
            }
            return(false);

        default:
            Debug.LogError("Error, enum never read !");
            return(false);
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Returns true if the value is between the two boundaries
    /// </summary>
    /// <param name="value"></param>
    /// <param name="lower"></param>
    /// <param name="greater"></param>
    /// <returns></returns>
    public static bool isBetween(this int value, int lower, int greater, ClusingType clusing)
    {
        float temp = (float)value;

        return(temp.isBetween(lower, greater, clusing));
    }