feat: PlayerSetState
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user