Ejemplo n.º 1
0
 public TweenTimer(TweenTimer timer)
 {
     state       = timer.state;
     currentTime = timer.currentTime;
     duration    = timer.duration;
     speed       = timer.speed;
     easeFunc    = timer.easeFunc;
 }
Ejemplo n.º 2
0
    // 補間クラス作成
    // targetObj
    // target
    // from
    // to
    // duduration or time
    // easeType
    // onComplete
    // delay
    // isLoop
    public static PTween _tween(params object[] props)
    {
        PTweenArgs args = new PTweenArgs(props);

        object obj = args.getValue <object>("targetObj", null);

        PTweenEaseFunc easeFunc = args.getValue <PTweenEaseFunc>("easeType", PEase.Linear);
        float          duration = args.getValue <float>("duration", "time", 1.0f);

        return(tween(obj, duration, easeFunc, props));
    }
Ejemplo n.º 3
0
    public static PTween tween(object obj, float duration, PTweenEaseFunc easeFunc, PTweenOnComplete onComplete, params object[] props)
    {
        PTweenArgs args  = new PTweenArgs(props);
        float      delay = args.getValue <float> ("delay", 0.0f);

        if (onComplete == null)
        {
            onComplete = args.getValue <PTweenOnComplete> ("onComplate", null);
        }
        PTween rtw = null;

        if (args.isExist("from") && args.isExist("to"))
        {
            if (args.isType <int>("from"))
            {
                rtw = play <int>(obj, args, duration, easeFunc, onComplete, delay);
            }
            else if (args.isType <float>("from"))
            {
                rtw = play <float>(obj, args, duration, easeFunc, onComplete, delay);
            }
            else if (args.isType <Vector2>("from"))
            {
                rtw = play <Vector2>(obj, args, duration, easeFunc, onComplete, delay);
            }
            else if (args.isType <Vector3>("from"))
            {
                rtw = play <Vector3>(obj, args, duration, easeFunc, onComplete, delay);
            }
            else if (args.isType <Vector4>("from"))
            {
                rtw = play <Vector4>(obj, args, duration, easeFunc, onComplete, delay);
            }
            else if (args.isType <Color>("from"))
            {
                rtw = play <Color>(obj, args, duration, easeFunc, onComplete, delay);
            }
            else if (args.isType <Quaternion>("from"))
            {
                rtw = play <Quaternion>(obj, args, duration, easeFunc, onComplete, delay);
            }
            else
            {
                Debug.LogError("PTween: invalid type:" + args.getType("from"));
                return(null);
            }
        }
        return(rtw);
    }
Ejemplo n.º 4
0
    private static PTween play <T>(object obj, PTweenArgs args, float duration, PTweenEaseFunc easeFunc, PTweenOnComplete onComplete, float delay) where T : struct
    {
        var tw = createTween <T>() as PTween <T>;

        if (tw != null)
        {
            tw.isLoop = args.getValue <bool> ("isLoop", false);

            if (obj != null)
            {
                string valueName = args.getValue <string> ("target", null);
                if (valueName != null)
                {
                    tw.setTarget(obj, valueName);
                }

                /*if(onComplete!=null) {
                 * tw.AddOnComplete(onComplete);
                 * }*/
            }
            tw.play(args.getValue <T>("from"), args.getValue <T>("to"), duration, easeFunc, onComplete, delay);
        }
        return(tw);
    }
Ejemplo n.º 5
0
 public static PTween tween(object obj, float duration, PTweenEaseFunc easeFunc, params object[] props)
 {
     return(tween(obj, duration, easeFunc, props));
 }
Ejemplo n.º 6
0
 // 補間クラス作成
 public static PTween tween <T>(object obj, string name, T from, T to, float duration, PTweenEaseFunc easeFunc, PTweenOnComplete onComplete = null, params object[] props)
 {
     return(tween(obj, duration, easeFunc, onComplete, "target", name, "from", from, "to", to));
 }
Ejemplo n.º 7
0
 public static PTween tween <T>(T from, T to, float duration, PTweenEaseFunc easeFunc, PTweenOnComplete onComplete = null, params object[] props)
 {
     return(PTweener.tween(null, null, from, to, duration, easeFunc, onComplete, props));
 }
Ejemplo n.º 8
0
 // Tweener
 public static PTween tween <T>(System.Object obj, string name, T from, T to, float duration, PTweenEaseFunc easeFunc, PTweenOnComplete onComplete = null, params object[] props)
 {
     return(PTweener.tween(obj, name, from, to, duration, easeFunc, onComplete, props));
 }