Ejemplo n.º 1
0
    private IEnumerator PlayTimedAnim(string animation, SFXRenderer renderer, SFXRendererCallback callback)
    {
        renderer.animator.Play(animation, -1, 0);
        yield return(new WaitForEndOfFrame());

        float time = renderer.animator.GetCurrentAnimatorStateInfo(0).length;

        yield return(new WaitForSeconds(time));

        callback(renderer);
    }
Ejemplo n.º 2
0
    private void PlayLoopingAnimation(SFXRenderer sfx, string anim)
    {
        if (sfx.currentAction != null)
        {
            StopCoroutine(sfx.currentAction);
        }

        SFXRendererCallback callback = delegate(SFXRenderer sfxR) {};

        sfx.spriteRenderer.enabled = true;
        sfx.animator.enabled       = true;

        sfx.currentAction =
            StartCoroutine(
                PlayLoopedAnim(anim, sfx, callback));
    }