Beispiel #1
0
    public void PlayAnim(int animIndex)
    {
        //Check that the current anim isn't already playing. If it is, do nothing. This will prevent the anim from jamming when using if/else statements to set animation states.
        AsepriteAnim desiredAnim = asepriteAnim.meta.frameTags[animIndex];

        if (desiredAnim != CurrentAnim)
        {
            CurrentAnim  = desiredAnim;
            CurrentFrame = asepriteAnim.frames[CurrentAnim.from];
            isPlaying    = true;
        }
        return;
    }
Beispiel #2
0
    public void PlayAnim(string animName)
    {
        //Check that the current anim isn't already playing. If it is, do nothing. This will prevent the anim from jamming when using if/else statements to set animation states.
        AsepriteAnim desiredAnim = asepriteAnim.meta.frameTags.Where(ft => ft.name == animName).FirstOrDefault();

        if (desiredAnim != CurrentAnim)
        {
            CurrentAnim  = desiredAnim;
            CurrentFrame = asepriteAnim.frames[CurrentAnim.from];
            isPlaying    = true;
        }
        return;
    }