Exemplo n.º 1
0
        public TweenParty AddTween(ITweenControl tween)
        {
            tween.Resume();
            _tweenList.Add(tween);

            return this;
        }
Exemplo n.º 2
0
        public TweenParty addTween(ITweenControl tween)
        {
            tween.resume();
            _tweenList.Add(tween);

            return(this);
        }
Exemplo n.º 3
0
        public ITween <T> setNextTween(ITweenControl nextTween)
        {
            if (nextTween is ITweenable)
            {
                _nextTween = nextTween as ITweenable;
            }
            else
            {
                Debug.LogError("attempted to set a tween that does not implement ITweenable as the nextTween!");
            }

            return(this);
        }
Exemplo n.º 4
0
 public void StopAllTweensWithTarget(object target, bool shouldCompleteTweens = false)
 {
     for (int i = activeTweens.Count - 1; i >= 0; i--)
     {
         if (activeTweens[i] is ITweenControl)
         {
             ITweenControl control = activeTweens[i] as ITweenControl;
             if (control.GetTargetObject() == target)
             {
                 control.Stop(shouldCompleteTweens);
             }
         }
     }
 }
Exemplo n.º 5
0
        public TweenChain appendTween(ITweenControl tween)
        {
            // make sure we have a legit ITweenable
            if (tween is ITweenable)
            {
                tween.resume();
                _tweenList.Add(tween as ITweenable);
            }
            else
            {
                Debug.LogError("attempted to add a tween that does not implement ITweenable to a TweenChain!");
            }

            return(this);
        }
Exemplo n.º 6
0
        public TweenParty addTween(ITweenControl tween)
        {
            // make sure we have a legit ITweenable
            if (tween is ITweenable)
            {
                // resume gets the tween into Playing mode so we can tick it
                tween.resume();
                _tweenList.Add(tween as ITweenable);
            }
            else
            {
                Debug.LogError("attempted to add a tween that does not implement ITweenable to a TweenParty!");
            }

            return(this);
        }
        protected override bool DoStep(float deltaTime)
        {
            if (m_tweens.Count == 0)
            {
                return(true);
            }

            var tween = m_tweens[m_currentIndex];

            if (tween != m_currentTween)
            {
                m_currentTween = tween;
                m_currentTween.Start();
            }

            m_currentTween.Step(deltaTime);

            if (!m_currentTween.isRunning)
            {
                m_currentTween = null;

                if (m_currentIndex < m_tweens.Count - 1)
                {
                    m_currentIndex++;
                }
                else
                {
                    if (isInfinite || m_currentIteration++ < repeatCount)
                    {
                        m_currentIndex = 0;

                        if (m_externRepeat != null)
                        {
                            m_externRepeat(m_currentIteration);
                        }
                    }
                    else
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 8
0
        public List <ITweenable> GetAllTweensWithTarget(object target)
        {
            List <ITweenable> foundTweens = new List <ITweenable>();

            for (int i = 0; i < activeTweens.Count; i++)
            {
                if (activeTweens[i] is ITweenControl)
                {
                    ITweenControl control = activeTweens[i] as ITweenControl;
                    if (control.GetTargetObject() == target)
                    {
                        foundTweens.Add(activeTweens[i] as ITweenable);
                    }
                }
            }

            return(foundTweens);
        }
Exemplo n.º 9
0
        private void PerformOnTweensAndClear(Action <ITweenControl> action)
        {
            if (m_currentEnqueued != null)
            {
                action(m_currentEnqueued);
                m_currentEnqueued = null;
            }

            foreach (var tween in m_queue)
            {
                action(tween);
            }
            m_queue.Clear();

            foreach (var yween in m_parallel)
            {
                action(yween);
            }
            m_parallel.Clear();
        }
Exemplo n.º 10
0
        private void UpdateQueued(float deltaTime)
        {
            if (m_currentEnqueued == null)
            {
                if (m_queue.Count > 0)
                {
                    m_currentEnqueued = m_queue.Dequeue();
                    m_currentEnqueued.Start();
                    m_currentEnqueued.Step(deltaTime);
                }
            }
            else
            {
                m_currentEnqueued.Step(deltaTime);

                if (!m_currentEnqueued.isRunning)
                {
                    m_currentEnqueued = null;
                }
            }
        }
 protected override void DoStart()
 {
     m_currentIndex     = 0;
     m_currentTween     = null;
     m_currentIteration = 1;
 }