Refactor Player class to use components, also use components in Enemy class types and fiddle with boss structure
This commit is contained in:
@@ -27,14 +27,18 @@ public partial class BossRoomA : Node3D, IBossRoom, IDungeonFloor
|
||||
|
||||
[Node] public Node3D GateCollision { get; set; } = default!;
|
||||
|
||||
[Node] public MeshInstance3D LOCKEDGATE { get; set; } = default!;
|
||||
|
||||
[Node] private Area3D _exit { get; set; } = default!;
|
||||
public ImmutableList<IDungeonRoom> Rooms { get; }
|
||||
public bool FloorIsLoaded { get; set; }
|
||||
|
||||
public void Setup()
|
||||
public void OnReady()
|
||||
{
|
||||
ActivateTrap.BodyEntered += ActivateTrap_BodyEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
OxFace.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
|
||||
HorseFace.HealthComponent.HealthReachedZero += CheckForBossFightEnd;
|
||||
}
|
||||
|
||||
private void ActivateTrap_BodyEntered(Node3D body)
|
||||
@@ -51,9 +55,16 @@ public partial class BossRoomA : Node3D, IBossRoom, IDungeonFloor
|
||||
HorseFace.StartFight();
|
||||
}
|
||||
|
||||
private void CheckForBossFightEnd()
|
||||
{
|
||||
if (OxFace.HealthComponent.CurrentHP.Value <= 0 && HorseFace.HealthComponent.CurrentHP.Value <= 0)
|
||||
OnBossFightEnded();
|
||||
}
|
||||
|
||||
public void OnBossFightEnded()
|
||||
{
|
||||
GateCollision.CallDeferred(MethodName.QueueFree);
|
||||
LOCKEDGATE.Hide();
|
||||
}
|
||||
|
||||
public void ExitReached()
|
||||
|
||||
Reference in New Issue
Block a user