BBGamelib.FloatUtils.EQ C# (CSharp) Method

EQ() public static method

public static EQ ( float a, float b ) : bool
a float
b float
return bool
		public static bool EQ(float a, float b){
			bool equal = Mathf.Abs (b - a) < Epsilon;
			return equal;
		}

Usage Example

        public override void update(float t)
        {
            // waits until enough time has passed for the next shake
            if (FloatUtils.EQ(shakeInterval, 0))
            {
            }              // shake every frame!
            else if (FloatUtils.Small(t, nextShake))
            {
                return;                 // haven't reached the next shake point yet
            }
            else
            {
                nextShake += shakeInterval;                 // proceed with shake this time and increment for next shake goal
            }
            // calculate the dampening effect, if being used
            if (dampening)
            {
                float dFactor = (1 - t);
                amplitude.x = dFactor * startAmplitude.x;
                amplitude.y = dFactor * startAmplitude.y;
            }

            Vector2 newp = new Vector2((Random.Range(0, 100) / 100.0f * amplitude.x * 2) - amplitude.x, (Random.Range(0, 100) / 100.0f * amplitude.y * 2) - amplitude.y);

            // simultaneously un-move the last shake and move the next shake
            ((CCNode)_target).position = ((CCNode)_target).position - last + newp;

            // store the current shake value so it can be un-done
            last = newp;
        }
All Usage Examples Of BBGamelib.FloatUtils::EQ