feat: broken crouching
This commit is contained in:
@ -66,6 +66,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
private StateChartState _actionHanging;
|
||||
// Movement state
|
||||
private StateChartState _grounded;
|
||||
private StateChartState _crouched;
|
||||
private StateChartState _standing;
|
||||
private StateChartState _mantling;
|
||||
private StateChartState _movHanging;
|
||||
private StateChartState _wallHugging;
|
||||
@ -132,6 +134,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
_actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||
// Movement states
|
||||
_grounded = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded"));
|
||||
_standing = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded/Standing"));
|
||||
_crouched = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded/Crouched"));
|
||||
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
||||
_movHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/Hanging"));
|
||||
_airborne = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne"));
|
||||
@ -200,6 +204,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
_aiming.StateEntered += OnAimingEntered;
|
||||
_aiming.StateExited += ResetTimeScale;
|
||||
|
||||
_crouched.StatePhysicsProcessing += HandleGroundedCrouched;
|
||||
_standing.StatePhysicsProcessing += HandleGroundedStanding;
|
||||
_grounded.StateEntered += OnGrounded;
|
||||
_grounded.StatePhysicsProcessing += HandleGrounded;
|
||||
_airborne.StatePhysicsProcessing += HandleAirborne;
|
||||
@ -280,6 +286,16 @@ public partial class PlayerController : CharacterBody3D
|
||||
_isWallJumpAvailable = true;
|
||||
}
|
||||
|
||||
public void OnStanding()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnCrouched()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool CanPerformDashAction()
|
||||
{
|
||||
return DashActionsLeft > 0 && _dashCooldownTimer.IsStopped();
|
||||
@ -495,6 +511,16 @@ public partial class PlayerController : CharacterBody3D
|
||||
if (!isOnFloorCustom())
|
||||
_playerState.SendEvent("start_falling");
|
||||
}
|
||||
public void HandleGroundedStanding(float delta)
|
||||
{
|
||||
CapsuleCollider.UndoCrouching(delta, 1);
|
||||
HeadSystem.SetHeight(CapsuleCollider.GetCurrentHeight());
|
||||
}
|
||||
public void HandleGroundedCrouched(float delta)
|
||||
{
|
||||
CapsuleCollider.Crouch(delta, 1);
|
||||
HeadSystem.SetHeight(CapsuleCollider.GetCurrentHeight());
|
||||
}
|
||||
public void HandleAirborne(float delta)
|
||||
{
|
||||
if (isOnFloorCustom())
|
||||
|
Reference in New Issue
Block a user