Exemple #1
0
 private void OnLoopCompelete()
 {
     if (_tv != null)
     {
         _tv.Recyle();
         _tv = null;
     }
 }
Exemple #2
0
        private void OnLoopCompele()
        {
            switch (loopType)
            {
            case LoopType.ReStart:
                _index++;
                _index    = (_index) % (_array.Length - 1);
                direction = TweenDirection.Forward;
                break;

            case LoopType.PingPong:
                switch (direction)
                {
                case TweenDirection.Forward:
                    _index++;
                    if (_index >= _array.Length - 1)
                    {
                        direction = TweenDirection.Back;
                    }
                    break;

                case TweenDirection.Back:
                    _index--;
                    if (_index <= 0)
                    {
                        direction = TweenDirection.Forward;
                    }
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
            if (_tv != null)
            {
                _tv.Recyle();
                _tv = null;
            }
        }
Exemple #3
0
        public void Run()
        {
            if (recyled)
            {
                return;
            }

            _seq = this.Sequence(env.envType)
                   .Repeat((r) =>
            {
                _repeat = r.Sequence((s) =>
                {
                    s.Until(() => {
                        if (recyled)
                        {
                            return(true);
                        }
                        return(_tv.compeleted);
                    })
                    .OnCompelete(() => {
                        if (_tv != null)
                        {
                            _tv.Recyle();
                            _tv = null;
                        }
                    })
                    .OnBegin(() => {
                        if (recyled)
                        {
                            return;
                        }

                        _tv       = TweenValue.Get <T>(env.envType);
                        _tv.curve = curve;
                        switch (loopType)
                        {
                        case LoopType.ReStart:
                            _tv.Config(start, end, dur, getter, (value) => { cur = value; }, null);
                            break;

                        case LoopType.PingPong:
                            if (_startToEnd)
                            {
                                _tv.Config(start, end, dur, getter, (value) => { cur = value; }, null);

                                _startToEnd = false;
                            }
                            else
                            {
                                _tv.Config(end, start, dur, getter, (value) => { cur = value; }, null);

                                _startToEnd = true;
                            }
                            //if (cur.Equals(start))

                            //else if(cur .Equals(end))
                            //    _tv.Config(end, start, dur, getter, (value) => { cur = value; }, null);
                            //else
                            //    _tv.Config(start, end, dur, getter, (value) => { cur = value; }, null);

                            break;

                        default:
                            break;
                        }
                        _tv.Run();
                    });
                });
            }, loop)
                   .OnCompelete(() =>
            {
                if (onCompelete != null)
                {
                    onCompelete();
                }
                TryRecyleSelf();
            })
                   .Run();
        }