Ejemplo n.º 1
0
        /// <summary>
        /// Updates all existing tweens.
        /// </summary>
        private void UpdateTweens()
        {
            for (int i = _tweenInfos.Count - 1; i >= 0; i--)
            {
                TweenInfo info = _tweenInfos[i];

                if (info.Delay > 0.0f)
                {
                    info.Delay -= Time.unscaledDeltaTime;
                    continue;
                }

                // Advance the time.
                info.Time += Time.unscaledDeltaTime;

                // Compute the normalized time.
                float t = this.ComputeNormalizedTime(info.Time, info.Duration, info.Ease);

                // Invoke custom updaters.
                if (info.OnUpdate != null)
                {
                    info.OnUpdate(t);
                }

                // Check if the tween has finished.
                if (info.Time >= info.Duration)
                {
                    if (info.OnComplete != null)
                    {
                        info.OnComplete();
                    }

                    _tweenInfos.RemoveAt(i);
                }
            }
        }