Exemple #1
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);
    }