Beispiel #1
0
        private async Task Loop()
        {
            StartEvt?.Invoke();
            do
            {
                for (_currentTweenTime = 0; _currentTweenTime < Duration; _currentTweenTime += Time.deltaTime)
                {
                    if (CheckShouldBeStopped())
                    {
                        return;
                    }

                    TweenStrategy(_currentTweenTime);
                    UpdateEvt?.Invoke();
                    await Task.Yield();

                    if (!Application.isPlaying)
                    {
                        return;
                    }

                    if (await WaitPaused())
                    {
                        return;
                    }
                }

                if (LoopCount > 0)
                {
                    LoopCount--;
                }

                CheckLoopEnd();
            } while (LoopCount != 0);


            if (!ShouldBeStopped)
            {
                Apply?.Invoke(Instruction.GetFinish());
                CompleteEvt?.Invoke();
                Reset();
            }
        }