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; }
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; }