Beispiel #1
0
        public void update(float deltaTime)
        {
            if (!forwards)
            {
                deltaTime *= -1;
            }
            deltaTime *= timescale;

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (deltaTime == 0)
            {
                return;
            }

            if (forwards && sequence.isAtZero() || !forwards && sequence.isAtDuration())
            {
                onStart_?.Invoke(forwards);
            }

            var previousTime = sequence.timePassed;

            sequence.update(deltaTime);

            if (forwards && sequence.isAtDuration() || !forwards && sequence.isAtZero())
            {
                if (looping.shouldLoop(currentIteration))
                {
                    currentIteration++;
                    var unusedTime =
                        Math.Abs(previousTime + deltaTime - (forwards ? sequence.duration : 0));
                    switch (looping.mode)
                    {
                    case Loop.Mode.YoYo:
                        reverse();
                        break;

                    case Loop.Mode.Normal:
                        rewindTimePassed();
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    update(unusedTime);
                }
                else
                {
                    onEnd_?.Invoke(forwards);
                    stop();
                }
            }
        }
Beispiel #2
0
 public static void setRelativeTimePassedDefault(this ITweenSequence ts, float t) =>
 ts.update(t - ts.timePassed);
Beispiel #3
0
 public void update(float deltaTime) =>
 original.update(-deltaTime);