Ejemplo n.º 1
0
    public Animation2D PlayAnimation(string name, bool reset = true, bool reverse = false)
    {
        Animation2D found = GetAnimationByName(name);

        if (found != currentAnimation)
        {
            SwitchAnimation(found, reset, true, reverse);
        }
        else
        {
            if (!currentAnimation.IsPlaying())
            {
                currentAnimation.Play(reset, reverse);
            }
        }

        return(found);
    }
    public void ResumeAnimationByNameAndResetIfDone(string animationName)
    {
        Animation2D foundAnimation;

        animationsByName.TryGetValue(animationName, out foundAnimation);

        if (foundAnimation && canSwitchAnimations)
        {
            if (foundAnimation != currentAnimation)
            {
                if (!foundAnimation.IsPlaying())
                {
                    PlayAnimationByName(animationName, false);
                }
            }
            else if (!currentAnimation.IsPlaying())
            {
                PlayAnimationByName(animationName, true);
            }
        }
    }