private Vector2 GetDirectionFromMovement(PlayerInputControl.InputState input) { if (Attacking()) { return(lastDirection); } // prevent player from turning when attacking // Only return a new direction if it's the only direction being held if (input.IsOnlyUpHeld()) { return(Vector2.up); } else if (input.IsOnlyDownHeld()) { return(Vector2.down); } else if (input.IsOnlyLeftHeld()) { return(Vector2.left); } else if (input.IsOnlyRightHeld()) { return(Vector2.right); } return(lastDirection); }