Example #1
0
        public override void LerpAction(float dt)
        {
            if (dt >= _nextDt)
            {
                while (dt > _nextDt && _total < _times)
                {
                    _innerAction.LerpAction(1.0f);
                    _total++;

                    _innerAction.Stop();
                    _innerAction.StartWithTarget(target);
                    _nextDt = _innerAction.GetDuration() / duration * (_total + 1);
                }

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

                // don't set an instant action back or update it, it has no use because it has no duration
                if (_total == _times)
                {
                    _innerAction.LerpAction(1);
                    _innerAction.Stop();
                }
                else
                {
                    // issue #390 prevent jerk, use right update
                    _innerAction.LerpAction(dt - (_nextDt - _innerAction.GetDuration() / duration));
                }
            }
            else
            {
                _innerAction.LerpAction(dt * _times % 1.0f);
            }
        }