public void Add(TweenTrack track) { if (!_tracks.Contains(track)) { _tracks.Add(track); } }
public void Remove(TweenTrack track) { if (_tracks.Contains(track)) { _tracks.Remove(track); } }
public static TweenPlayer MoveTo2(this Transform trans, Vector3 start, Vector3 target, float duration, AnimationCurve easeEquation, bool unscaled = false, LoopType loopType = LoopType.Restart, int loop = 1, Action onComplete = null) { var player = TweenPlayer.Gen(); TweenTrack track = new TweenTrack(); player.Add(track); Tween t = new Tween(); t.SetFromValue(start.x, start.y, start.z); t.SetToValue(target.x, target.y, target.z); player.SetDefaultTime(unscaled); t.SetEase(EaseEquation.Linear); t.SetLoop(loopType, loop); track.bindTarget = trans; t.SetValuesSetter((o, x, y, z, w) => { ((Transform)o).position = new Vector3(x, y, z); }); t.startTime = 0; t.SetDuration(duration); t.endTime = duration * loop; player.SetDuration(duration * loop); track.Add(t); player.Play(); return(player); }