feat: PlayerSetState

This commit is contained in:
2026-05-27 15:14:14 +02:00
parent 17773d1b46
commit 186a2a5258

View File

@@ -298,7 +298,28 @@ public class Player : MonoBehaviour
private void SetState() private void SetState()
{ {
if (State.IsGrounded)
{
if (State.HorizontalVelocity.sqrMagnitude > .1f)
{
State.CurrentState = PlayerState.Moving;
}
else
{
State.CurrentState = PlayerState.Idle;
}
}
else
{
if (State.VerticalVelocity > 0)
{
State.CurrentState = PlayerState.Jumping;
}
else
{
State.CurrentState = PlayerState.Falling;
}
}
} }
#endregion #endregion
} }