Beispiel #1
0
 public static void RemoveAll()
 {
     for (int i = 0; i < tweensCount; i++)
     {
         TweenCase tween = tweens[i];
         if (tween != null)
         {
             tween.Kill();
         }
     }
 }
Beispiel #2
0
        private void Update()
        {
            if (!hasActiveTweens)
            {
                return;
            }

            if (requiresActiveReorganization)
            {
                ReorganizeActiveTweens();
            }

            float deltaTime         = Time.deltaTime;
            float unscaledDeltaTime = Time.unscaledDeltaTime;

            for (int i = 0; i < tweensCount; i++)
            {
                TweenCase tween = tweens[i];
                if (tween != null)
                {
                    if (tween.isActive && !tween.isPaused)
                    {
                        if (!tween.isUnscaled)
                        {
                            if (Time.timeScale == 0)
                            {
                                continue;
                            }

                            tween.NextState(deltaTime);
                        }
                        else
                        {
                            tween.NextState(unscaledDeltaTime);
                        }

                        tween.Invoke();

                        if (tween.isCompleted)
                        {
                            tween.DefaultComplete();

                            if (tween.onCompleteCallback != null)
                            {
                                tween.onCompleteCallback.Invoke();
                            }

                            tween.Kill();
                        }
                    }
                }
            }

            int killingTweensCount = killingTweens.Count - 1;

            for (int i = killingTweensCount; i > -1; i--)
            {
                RemoveActiveTween(killingTweens[i]);
            }
            killingTweens.Clear();
        }