Ejemplo n.º 1
0
        internal static void Update()
        {
            int cnt          = _totalActiveTweens;
            int freePosStart = -1;
            int freePosCount = 0;

            for (int i = 0; i < cnt; i++)
            {
                GTweener tweener = _activeTweens[i];
                if (tweener == null)
                {
                    if (freePosStart == -1)
                    {
                        freePosStart = i;
                    }
                    freePosCount++;
                }
                else if (tweener._killed)
                {
                    tweener._Reset();
                    _tweenerPool.Add(tweener);
                    _activeTweens[i] = null;

                    if (freePosStart == -1)
                    {
                        freePosStart = i;
                    }
                    freePosCount++;
                }
                else
                {
                    if (!tweener._paused)
                    {
                        tweener._Update();
                    }

                    if (freePosStart != -1)
                    {
                        _activeTweens[freePosStart] = tweener;
                        _activeTweens[i]            = null;
                        freePosStart++;
                    }
                }
            }

            if (freePosStart >= 0)
            {
                if (_totalActiveTweens != cnt)                 //new tweens added
                {
                    int j = cnt;
                    cnt = _totalActiveTweens - cnt;
                    for (int i = 0; i < cnt; i++)
                    {
                        _activeTweens[freePosStart++] = _activeTweens[j++];
                    }
                }
                _totalActiveTweens = freePosStart;
            }
        }
Ejemplo n.º 2
0
        internal static void Update()
        {
            if (_inited)
            {
                int cnt          = _totalActiveTweens;
                int freePosStart = -1;
                for (int i = 0; i < cnt; i++)
                {
                    GTweener tweener = _activeTweens[i];
                    if (tweener == null)
                    {
                        if (freePosStart == -1)
                        {
                            freePosStart = i;
                        }
                    }
                    else if (tweener._killed)
                    {
                        tweener._Reset();
                        _tweenerPool.Add(tweener);
                        _activeTweens[i] = null;

                        if (freePosStart == -1)
                        {
                            freePosStart = i;
                        }
                    }
                    else
                    {
                        if ((tweener._target is GObject) && ((GObject)tweener._target)._disposed)
                        {
                            tweener._killed = true;
                        }
                        else if (!tweener._paused)
                        {
                            tweener._Update();
                        }

                        if (freePosStart != -1)
                        {
                            _activeTweens[freePosStart] = tweener;
                            _activeTweens[i]            = null;
                            freePosStart++;
                        }
                    }
                }

                if (freePosStart >= 0)
                {
                    if (_totalActiveTweens != cnt) //new tweens added
                    {
                        int j = cnt;
                        cnt = _totalActiveTweens - cnt;
                        for (int i = 0; i < cnt; i++)
                        {
                            _activeTweens[freePosStart++] = _activeTweens[j];
                            _activeTweens[j] = null;
                            j++;
                        }
                    }
                    _totalActiveTweens = freePosStart;
                }
            }
        }