Boss Fight computer terminal implementation
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -16,14 +16,39 @@ public partial class BossRoomB : SpecialFloor, IBossRoom, IDungeonFloor
|
||||
|
||||
[Node] public DemonWall DemonWall { get; set; } = default!;
|
||||
|
||||
[Node] public ComputerTerminal ComputerTerminalA { get; set; } = default!;
|
||||
|
||||
[Node] public ComputerTerminal ComputerTerminalB { get; set; } = default!;
|
||||
|
||||
[Node] private Area3D ActivateTrap { get; set; } = default!;
|
||||
|
||||
[Node] private Area3D _exit { get; set; } = default!;
|
||||
|
||||
[Node] private CollisionShape3D BridgeCollision { get; set; } = default!;
|
||||
|
||||
[Node] private AnimationPlayer BridgeAnimationPlayer { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
ActivateTrap.BodyEntered += ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
ActivateTrap.BodyEntered += ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
BridgeAnimationPlayer.AnimationFinished += BridgeAnimationPlayer_AnimationFinished;
|
||||
ComputerTerminalA.HealthComponent.HealthReachedZero += TerminalDefeated;
|
||||
ComputerTerminalB.HealthComponent.HealthReachedZero += TerminalDefeated;
|
||||
}
|
||||
|
||||
private void TerminalDefeated()
|
||||
{
|
||||
if (ComputerTerminalA.HealthComponent.CurrentHP.Value <= 0 && ComputerTerminalB.HealthComponent.CurrentHP.Value <= 0)
|
||||
OpenBridgeFull();
|
||||
else
|
||||
OpenBridgeHalf();
|
||||
}
|
||||
|
||||
private void BridgeAnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "Bridge Extend Full")
|
||||
BridgeCollision.SetDeferred(CollisionShape3D.PropertyName.Disabled, true);
|
||||
}
|
||||
|
||||
private void ActivateTrap_AreaEntered(Node3D area) => StartBossFight();
|
||||
@@ -35,21 +60,31 @@ public partial class BossRoomB : SpecialFloor, IBossRoom, IDungeonFloor
|
||||
|
||||
public void StartBossFight()
|
||||
{
|
||||
DemonWall.Activate();
|
||||
DemonWall.Activate();
|
||||
}
|
||||
|
||||
public void ExitReached()
|
||||
=> Game.FloorExitReached();
|
||||
=> Game.FloorExitReached();
|
||||
|
||||
public void OpenBridgeHalf()
|
||||
{
|
||||
BridgeAnimationPlayer.Play("Bridge Extend Half");
|
||||
}
|
||||
|
||||
public void OpenBridgeFull()
|
||||
{
|
||||
BridgeAnimationPlayer.Play("Bridge Extend Full");
|
||||
}
|
||||
|
||||
private void Exit_AreaEntered(Area3D area)
|
||||
{
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
+115
-205
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user