EB() public static method

public static EB ( float a, float b ) : bool
a float
b float
return bool
Example #1
0
        /**
         * repeat will execute the action repeat + 1 times, for a continues action use kCCRepeatForever
         * delay is the amount of time the action will wait before execution
         */
        public void schedule(TICK_IMP selector, float interval = 0, uint repeat = CCScheduler.kCCRepeatForever, float delay = 0)
        {
            NSUtils.Assert(selector != null, "Argument must be non-nil");
            NSUtils.Assert(FloatUtils.EB(interval, 0), "Arguemnt must be positive");


            _scheduler.schedule(selector, this, interval, repeat, !_isRunning, delay);
        }
        public static Rect RectIntersection(Rect a, Rect b)
        {
            float x1 = Math.Max(a.x, b.x);
            float x2 = Math.Min(a.x + a.width, b.x + b.width);
            float y1 = Math.Max(a.y, b.y);
            float y2 = Math.Min(a.y + a.height, b.y + b.height);

            if (FloatUtils.EB(x2, x1) &&
                FloatUtils.EB(y2, y1))
            {
                return(new Rect(x1, y1, x2 - x1, y2 - y1));
            }
            return(new Rect(0, 0, 0, 0));
        }
        // issue #80. Instead of hooking step:, hook update: since it can be called by any
        // container action like CCRepeat, CCSequence, CCEase, etc..
        public override void update(float dt)
        {
            if (FloatUtils.EB(dt, _nextDt))
            {
                while (FloatUtils.Big(dt, _nextDt) && _total < _times)
                {
                    _innerAction.update(1.0f);
                    _total++;

                    _innerAction.stop();
                    _innerAction.startWithTarget(_target);
                    _nextDt += _innerAction.duration / _duration;
                }

                // fix for issue #1288, incorrect end value of repeat
                if (FloatUtils.EB(dt, 1.0f) && _total < _times)
                {
                    _total++;
                }

                // don't set a instantaction back or update it, it has no use because it has no duration
                if (!_isActionInstant)
                {
                    if (_total == _times)
                    {
                        _innerAction.update(1);
                        _innerAction.stop();
                    }
                    else
                    {
                        // issue #390 prevent jerk, use right update
                        _innerAction.update(dt - (_nextDt - _innerAction.duration / _duration));
                    }
                }
            }
            else
            {
                _innerAction.update((dt * _times) % 1.0f);
            }
        }
Example #4
0
 /** returns YES if the action has finished */
 public override bool isDone()
 {
     return(FloatUtils.EB(_elapsed, _duration));
 }