Esempio n. 1
0
        private Task move(Tween.Method method, Vector3 to, float time)
        {
            TweenTask tt = new TweenTask(delegate {
                Tween tween  = TweenLocalPosition.Begin(this.gameObject, time, to);
                tween.method = method;
                return(tween);
            });

            return(tt);
        }
Esempio n. 2
0
        private Task shake(Tween.Method method, int times, float time, Vector3 original, Vector3 border1, Vector3 border2)
        {
            TaskList tl    = new TaskList();
            int      index = 0;
            float    step  = time / (float)(times);

            Debug.LogWarning(step);
            while (times > 0)
            {
                switch (index)
                {
                case 0:
                    index = 1;

                    times -= 1;
                    tl.push(move(method, border1, step));
                    break;

                case 1:
                    if (times >= 2)
                    {
                        index -= 2;
                        index  = -1;
                        tl.push(move(method, border2, 2 * step));
                    }
                    else
                    {
                        times -= 1;
                        index  = 0;
                        tl.push(move(method, original, 2 * step));
                    }
                    break;

                case -1:
                    if (times >= 2)
                    {
                        times -= 2;
                        index  = 1;
                        tl.push(move(method, border1, 2 * step));
                    }
                    else
                    {
                        times -= 1;
                        index  = 0;

                        tl.push(move(method, original, step));
                    }
                    break;
                }
            }
            return(tl);
        }
Esempio n. 3
0
 public static Tween SetMethod(this Tween tween, Tween.Method method)
 {
     tween.method = method;
     return(tween);
 }