gd: mapped dash actions on guide inputs

This commit is contained in:
2025-06-05 12:19:24 +02:00
parent 178553956d
commit b517404dc4
6 changed files with 54 additions and 32 deletions

View File

@ -37,6 +37,7 @@ public partial class PlayerController : CharacterBody3D
private float _inputRotateFloorplane = 0.0f;
private bool _isAiming = false;
private bool _dashCanceled = false;
public void OnInputMove(Vector3 value)
{
@ -55,18 +56,21 @@ public partial class PlayerController : CharacterBody3D
public void OnInputAimPressed()
{
_isAiming = true;
GD.Print("Aim pressed");
if (_dashCanceled)
return;
DashSystem.PrepareDash();
}
public void OnInputAimReleased()
{
_isAiming = false;
GD.Print("Aim released");
if (!_dashCanceled)
DashSystem.Dash();
_dashCanceled = false;
}
public void OnInputAimCanceled()
{
_isAiming = false;
GD.Print("Aim canceled");
_dashCanceled = true;
DashSystem.CancelDash();
}
public void OnInputJumpPressed()
@ -144,7 +148,7 @@ public partial class PlayerController : CharacterBody3D
StairsSystem.Init(stairsBelowRayCast3D, stairsAheadRayCast3D, cameraSmooth);
DashSystem = GetNode<DashSystem>("DashSystem");
DashSystem.Init(HeadSystem, camera);
DashSystem.Init(HeadSystem, camera, TweenQueueSystem);
HealthSystem = GetNode<HealthSystem>("HealthSystem");
@ -166,25 +170,17 @@ public partial class PlayerController : CharacterBody3D
{
TweenQueueSystem.ProcessTweens();
if (Input.IsActionPressed("aim_dash"))
{
(_shouldMantle, _dashLocation, _mantleLocation) = DashSystem.PrepareDash();
}
if (Input.IsActionJustReleased("aim_dash"))
{
DashSystem.Dash();
TweenQueueSystem.QueueTween(_dashLocation, 0.1f);
if (_shouldMantle)
{
TweenQueueSystem.QueueTween(_mantleLocation, 0.1f);
}
}
var isPlayerDead = HealthSystem.IsDead();
var isHeadTouchingCeiling = IsHeadTouchingCeiling();
MoveSystem.MoveAround(delta, _inputMove, isOnFloorCustom(), isPlayerDead, isHeadTouchingCeiling);
var moveAroundParams = new MoveSystem.MoveAroundParameters(
delta,
_inputMove,
isOnFloorCustom(),
isPlayerDead,
isHeadTouchingCeiling);
MoveSystem.MoveAround(moveAroundParams);
Vector2 inputLookDir = new Vector2(_inputRotateY, _inputRotateFloorplane);
HeadSystem.LookAround(inputLookDir);