static public EZSkeletalTween Begin(GameObject bone, JsonSkeletalObj[] datas, float speed) { EZSkeletalTween comp = EZSkeletalTween.Play(bone, datas, speed, 0, 0); comp._time = 0; return(comp); }
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); }
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); } }
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); } }