Esempio n. 1
0
 //do this at the end of frame?
 public void UpdatePlayerDirection(Vector2 lookAtPosition)
 {
     if (hurtbox.GetRect().center.x > lookAtPosition.x)
     {
         _currentState.UpdateDirection(Direction.LEFT);
     }
     if (hurtbox.GetRect().center.x < lookAtPosition.x)
     {
         _currentState.UpdateDirection(Direction.RIGHT);
     }
     anim.Reverse(_currentState.IsFacingRight());
 }