Example #1
0
    static public EZSkeletalTween Begin(GameObject bone, JsonSkeletalObj[] datas, float speed)
    {
        EZSkeletalTween comp = EZSkeletalTween.Play(bone, datas, speed, 0, 0);

        comp._time = 0;
        return(comp);
    }
Example #2
0
    static public EZSkeletalTween Play(GameObject bone, JsonSkeletalObj[] datas, float speed, int n, float time)
    {
        int temp = 0;

        for (int m = 0; m < n + 1; ++m)
        {
            temp += datas[m].d;
        }

        float duration = temp * speed - time;

        if (duration < 0)
        {
            duration = 0;
        }
        EZSkeletalTween comp = EZTweener.Begin <EZSkeletalTween>(bone, duration);

        comp._bone  = bone;
        comp._datas = datas;
        comp._speed = speed;
        comp._n     = n;
        comp.setup();
        comp.onFinished = EZSkeletalTween.OnFinished_;

        if (duration <= 0f)
        {
            comp.Sample(1f, true);
            EZSkeletalTween.OnFinished_(comp);
        }
        return(comp);
    }
Example #3
0
 public static void onClose(EZTweener tween)
 {
     if (tween)
     {
         EZSkeletalTween tw = (EZSkeletalTween)(tween);
         tw.enabled  = false;;
         tween._time = 0;
         tw._bone.SendMessage("OnFinished", tw, SendMessageOptions.DontRequireReceiver);
     }
 }
Example #4
0
    public static void OnFinished_(EZTweener tween)
    {
        EZSkeletalTween tw = (EZSkeletalTween)(tween);

        if (tw._n + 1 < tw._datas.Length)
        {
            EZSkeletalTween.Play(tw._bone, tw._datas, tw._speed, tw._n + 1, tw._time);
        }
        else
        {
            tw.enabled = false;
            tw._time   = 0;
            tw._bone.SendMessage("OnFinished", tw, SendMessageOptions.DontRequireReceiver);
        }
    }