// Start is called before the first frame update void Start() { Body = GetComponent <Rigidbody2D>(); Body.freezeRotation = true; // Default facing direction is "down" player_facing = CharacterFacingDirection.DOWN; }
/// <summary> /// Sets the direction the player is facing. /// </summary> private void FaceDirection() { if (m_Movement.x > 0) { player_facing = CharacterFacingDirection.RIGHT; } else if (m_Movement.x < 0) { player_facing = CharacterFacingDirection.LEFT; } else if (m_Movement.y > 0) { player_facing = CharacterFacingDirection.UP; } else if (m_Movement.y < 0) { player_facing = CharacterFacingDirection.DOWN; } }