Exemple #1
0
    static public EZJointTween Play(GameObject bone, GameObject joint, exSprite sprite, EZSkew skew, 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;
        }
        EZJointTween comp = EZTweener.Begin <EZJointTween>(joint, duration);

        comp.sprite_ = sprite;
        comp.skew_   = skew;
        comp._joint  = joint;
        comp._bone   = bone;
        comp._datas  = datas;
        comp._speed  = speed;
        comp._n      = n;
        comp.setup();
        comp.onFinished = EZJointTween.OnFinished_;

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

        if (tw._n + 1 < tw._datas.Length)
        {
            EZJointTween.Play(tw._bone, tw._joint, tw.sprite_, tw.skew_, tw._datas, tw._speed, tw._n + 1, tw._time);
        }
        else
        {
            tw.enabled = false;
            tw._time   = 0;
            tw._bone.SendMessage("OnFinished", tw, SendMessageOptions.DontRequireReceiver);
        }
    }
Exemple #4
0
 static public EZJointTween Begin(GameObject bone, GameObject joint, exSprite sprite, EZSkew skew, JsonSkeletalObj[] datas, float speed)
 {
     return(EZJointTween.Play(bone, joint, sprite, skew, datas, speed, 0, 0));
 }