refacto: moved systems from player controller physics process to their own signal based systems

This commit is contained in:
2025-06-02 17:58:40 +02:00
parent c3e2c974ca
commit 178553956d
13 changed files with 377 additions and 248 deletions

View File

@ -17,6 +17,8 @@ public partial class MantleSystem: Node3D
private ShapeCast3D _wallInFrontCast3D;
private ShapeCast3D _mantleCast3D;
private RayCast3D _mantleCheckCast3D;
private Option<Vector3> _mantleLocation;
public void Init(Node3D head)
{
@ -25,21 +27,29 @@ public partial class MantleSystem: Node3D
_mantleCast3D = GetNode<ShapeCast3D>("MantleCast3D");
}
public Option<Vector3> FindMantleInFrontOfPlayer()
public override void _PhysicsProcess(double delta)
{
base._PhysicsProcess(delta);
_wallInFrontCast3D.SetRotation(new Vector3(
_wallInFrontCast3D.Rotation.X,
_head.Rotation.Y,
_wallInFrontCast3D.Rotation.Z));
if (!_wallInFrontCast3D.IsColliding())
{
return Option<Vector3>.None;
_mantleLocation = Option<Vector3>.None;
return;
}
var collisionPoint = _wallInFrontCast3D.GetCollisionPoint(0);
var collisionNormal = _wallInFrontCast3D.GetCollisionNormal(0);
return FindMantleLocationAtPoint(collisionPoint, collisionNormal);
_mantleLocation = FindMantleLocationAtPoint(collisionPoint, collisionNormal);
}
public Option<Vector3> FindMantleInFrontOfPlayer()
{
return _mantleLocation;
}
public Option<Vector3> FindMantleLocationAtPoint(Vector3 point, Vector3 wallNormal)