gd: added hit input

This commit is contained in:
2025-06-05 13:58:22 +02:00
parent b517404dc4
commit 8818e77d23
5 changed files with 61 additions and 14 deletions

View File

@ -73,6 +73,11 @@ public partial class PlayerController : CharacterBody3D
DashSystem.CancelDash();
}
public void OnInputHitPressed()
{
GD.Print("OnInputHitPressed");
}
public void OnInputJumpPressed()
{
bool doesCapsuleHaveCrouchingHeight = CapsuleCollider.IsCrouchingHeight();
@ -81,28 +86,26 @@ public partial class PlayerController : CharacterBody3D
if (!doesCapsuleHaveCrouchingHeight && !isPlayerDead)
MoveSystem.Jump(IsOnFloor());
}
public override void _Ready()
{
HeadSystem = GetNode<HeadSystem>("HeadSystem");
HeadSystem.Init();
_headCollisionDetectors = new RayCast3D[NumOfHeadCollisionDetectors];
for (int i = 0; i < NumOfHeadCollisionDetectors; i++)
{
_headCollisionDetectors[i] = GetNode<RayCast3D>(
"HeadCollisionDetectors/HeadCollisionDetector" + i);
}
HeadSystem = GetNode<HeadSystem>("HeadSystem");
HeadSystem.Init();
// Getting dependencies of the components(In godot we manage this from upwards to downwards not vice versa)
Camera3D camera = GetNode<Camera3D>("HeadSystem/CameraSmooth/Camera3D");
Node3D cameraSmooth = GetNode<Node3D>("HeadSystem/CameraSmooth");
RayCast3D stairsBelowRayCast3D = GetNode<RayCast3D>("StairsBelowRayCast3D");
RayCast3D stairsAheadRayCast3D = GetNode<RayCast3D>("StairsAheadRayCast3D");
Node3D cameraSmooth = GetNode<Node3D>("HeadSystem/CameraSmooth");
// Getting universal setting from GODOT editor to be in sync
float gravitySetting = (float)ProjectSettings.GetSetting("physics/3d/default_gravity");
@ -162,7 +165,6 @@ public partial class PlayerController : CharacterBody3D
DistortionRect = distortionRect,
BlurRect = blurRect,
};
HealthSystem.Init(healthSystemParams);
}
@ -190,7 +192,6 @@ public partial class PlayerController : CharacterBody3D
IsOnFloorCustom = isOnFloorCustom(),
Velocity = Velocity
};
Bobbing.PerformCameraBobbing(cameraBobbingParams);
FieldOfView.FovParameters fovParams = new FieldOfView.FovParameters
@ -200,7 +201,6 @@ public partial class PlayerController : CharacterBody3D
SprintSpeed = MoveSystem.SprintSpeed,
Velocity = Velocity
};
FieldOfView.PerformFovAdjustment(fovParams);
StairsSystem.UpStairsCheckParams upStairsCheckParams = new StairsSystem.UpStairsCheckParams
@ -260,7 +260,6 @@ public partial class PlayerController : CharacterBody3D
BetweenCrouchingAndNormalHeight = CapsuleCollider.IsBetweenCrouchingAndNormalHeight(),
Delta = (float)delta
};
StairsSystem.SlideCameraSmoothBackToOrigin(slideCameraParams);
}