private string GetAnimStateName(Direction2D4 direction, Direction2D4Animation animationMap) { var dict = new Dictionary <Direction2D4, string>() { { Direction2D4.Top, animationMap.Top }, { Direction2D4.Left, animationMap.Left }, { Direction2D4.Bottom, animationMap.Bottom }, { Direction2D4.Right, animationMap.Right }, }; return(dict[direction]); }
private bool TryPlayAnim(Direction2D4Animation animationMap) { var anim = GetAnimStateName(direction.ToDirection4(), animationMap); if (currentAnim != anim) { mAnimator.Play(anim); currentAnim = anim; return(true); } return(false); }