Rework enemy behavior (still in progress but shouldn't crash)
This commit is contained in:
@@ -33,44 +33,36 @@ public partial class BossRoomA : Node3D, IBossRoom, IDungeonFloor
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
ActivateTrap.BodyEntered += ActivateTrap_BodyEntered;
|
||||
OxFace.CurrentHP.Sync += BossStatusUpdate;
|
||||
HorseFace.CurrentHP.Sync += BossStatusUpdate;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
ActivateTrap.BodyEntered += ActivateTrap_BodyEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
}
|
||||
|
||||
private void ActivateTrap_BodyEntered(Node3D body)
|
||||
{
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||
StartBossFight();
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||
StartBossFight();
|
||||
}
|
||||
|
||||
public void StartBossFight()
|
||||
{
|
||||
OxFaceStatue.Hide();
|
||||
HorseHeadStatue.Hide();
|
||||
OxFace.StartFight();
|
||||
HorseFace.StartFight();
|
||||
OxFaceStatue.Hide();
|
||||
HorseHeadStatue.Hide();
|
||||
OxFace.StartFight();
|
||||
HorseFace.StartFight();
|
||||
}
|
||||
|
||||
public void OnBossFightEnded()
|
||||
{
|
||||
GateCollision.CallDeferred(MethodName.QueueFree);
|
||||
}
|
||||
|
||||
private void BossStatusUpdate(double hp)
|
||||
{
|
||||
if (OxFace.CurrentHP.Value <= 0 && HorseFace.CurrentHP.Value <= 0)
|
||||
OnBossFightEnded();
|
||||
GateCollision.CallDeferred(MethodName.QueueFree);
|
||||
}
|
||||
|
||||
public void ExitReached()
|
||||
=> Game.FloorExitReached();
|
||||
=> Game.FloorExitReached();
|
||||
|
||||
private void Exit_AreaEntered(Area3D area)
|
||||
{
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
}
|
||||
|
||||
public void InitializeDungeon()
|
||||
|
||||
Reference in New Issue
Block a user