Esempio n. 1
0
 public void Add(TweenTrack track)
 {
     if (!_tracks.Contains(track))
     {
         _tracks.Add(track);
     }
 }
Esempio n. 2
0
 public void Remove(TweenTrack track)
 {
     if (_tracks.Contains(track))
     {
         _tracks.Remove(track);
     }
 }
Esempio n. 3
0
        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);
        }