From 186a2a52585091c335cbf431d264d085404be491 Mon Sep 17 00:00:00 2001 From: Alexandre Coirier Date: Wed, 27 May 2026 15:14:14 +0200 Subject: [PATCH] feat: PlayerSetState --- Assets/_Content/Scripts/Player.cs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Assets/_Content/Scripts/Player.cs b/Assets/_Content/Scripts/Player.cs index 0eba969..ca087ff 100644 --- a/Assets/_Content/Scripts/Player.cs +++ b/Assets/_Content/Scripts/Player.cs @@ -298,7 +298,28 @@ public class Player : MonoBehaviour 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 }