private void OnLoopCompelete() { if (_tv != null) { _tv.Recyle(); _tv = null; } }
public override void Rewind(float duration, bool snap = false) { if (recyled) { return; } direction = TweenDirection.Forward; RecycleInner(); _tv = TweenValue.Get <T>(env.envType); _tv.converter = converter; var plugin = Allocate <RecyclablePlugin <T> >(env.envType); plugin.Config(current, start, duration, getter, (value) => { current = value; }, snap); _tv.Config(plugin, TryRecyleSelf); _tv.Run(); }
private void RecycleInner() { if (_tv != null && !_tv.recyled) { _tv.Recyle(); _tv = null; } if (_seq != null && !_seq.recyled) { _seq.Recyle(); _seq = null; } if (_repeat != null && !_repeat.recyled) { _repeat.Recyle(); _repeat = null; } }
public void Rewind(float dur) { if (recyled) { return; } _startToEnd = true; RecycleInner(); _tv = TweenValue.Get <T>(env.envType); _tv.curve = curve; _tv.Config(cur, start, dur, getter, (value) => { cur = value; }, () => { TryRecyleSelf(); }); _tv.Run(); }
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; } }
private void OnLoopBegin() { if (recyled) { return; } _tv = TweenValue.Get <T>(env.envType); _tv.converter = converter; switch (loopType) { case LoopType.ReStart: { var plugin = Allocate <RecyclablePlugin <T> >(env.envType); plugin.Config(start, end, duration, getter, (value) => { current = value; }, snap); _tv.Config(plugin, null); } break; case LoopType.PingPong: if (direction == TweenDirection.Forward) { var plugin = Allocate <RecyclablePlugin <T> >(env.envType); plugin.Config(start, end, duration, getter, (value) => { current = value; }, snap); _tv.Config(plugin, null); direction = TweenDirection.Back; } else { var plugin = Allocate <RecyclablePlugin <T> >(env.envType); plugin.Config(end, start, duration, getter, (value) => { current = value; }, snap); _tv.Config(plugin, null); direction = TweenDirection.Forward; } break; default: break; } _tv.Run(); }
private void OnLoopBegin() { if (recyled) { return; } _tv = TweenValue.Get <T>(env.envType); _tv.converter = converter; switch (direction) { case TweenDirection.Forward: { T _start = _array[_index]; T _end = _array[_index + 1]; var plugin = Allocate <RecyclablePlugin <T> >(env.envType); plugin.Config(_start, _end, duration / (_array.Length - 1), getter, (value) => { current = value; }, snap); _tv.Config(plugin, null); } break; case TweenDirection.Back: { T _end = _array[_index - 1]; T _start = _array[_index]; var plugin = Allocate <RecyclablePlugin <T> >(env.envType); plugin.Config(_start, _end, duration / (_array.Length - 1), getter, (value) => { current = value; }, snap); _tv.Config(plugin, null); } break; default: break; } _tv.Run(); }
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(); }