Clean up events, add weapon tag for weaker on swing
This commit is contained in:
@@ -61,4 +61,10 @@ public partial class Altar : SpecialFloor, IDungeonFloor
|
||||
}
|
||||
|
||||
public void ExitReached() => Game.FloorExitReached();
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
Exit.AreaEntered -= Exit_AreaEntered;
|
||||
NoExitArea.AreaEntered -= NoExitArea_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,12 @@ public partial class BossRoomA : SpecialFloor, IBossRoom, IDungeonFloor
|
||||
}
|
||||
|
||||
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawn.Rotation, new Vector3(PlayerSpawn.GlobalPosition.X, -2.5f, PlayerSpawn.GlobalPosition.Z)); }
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_BodyEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
OxFace.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||
HorseHead.HealthComponent.HealthReachedZero -= CheckForBossFightEnd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Immutable;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
@@ -47,4 +46,10 @@ public partial class BossRoomB : SpecialFloor, IBossRoom, IDungeonFloor
|
||||
if (area.GetOwner() is IPlayer)
|
||||
ExitReached();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
ActivateTrap.BodyEntered -= ActivateTrap_AreaEntered;
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,18 @@ public partial class CorridorRoom : Node3D
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
if (_room != null)
|
||||
_room.BodyEntered += Room_BodyEntered;
|
||||
if (_room != null)
|
||||
_room.BodyEntered += Room_BodyEntered;
|
||||
}
|
||||
|
||||
private void Room_BodyEntered(Node3D body)
|
||||
{
|
||||
if (!Game.CurrentFloor.FloorIsLoaded)
|
||||
return;
|
||||
if (!Game.CurrentFloor.FloorIsLoaded)
|
||||
return;
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
_room.BodyEntered -= Room_BodyEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,15 +18,21 @@ public partial class ExitRoom : DungeonRoom
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
_exit.AreaEntered += Exit_AreaEntered;
|
||||
}
|
||||
|
||||
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 new void OnExitTree()
|
||||
{
|
||||
base.OnExitTree();
|
||||
_exit.AreaEntered -= Exit_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -24,4 +25,9 @@ public partial class FinalFloor : SpecialFloor
|
||||
{
|
||||
_player.Die();
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
Exit.AreaEntered -= Exit_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,10 @@ public partial class JumpScareRoom : DungeonRoom
|
||||
DialogueController.ShowDialogue(Dialogue, "general");
|
||||
JumpScare.SetMonitoring(false);
|
||||
}
|
||||
|
||||
public new void OnExitTree()
|
||||
{
|
||||
base.OnExitTree();
|
||||
JumpScare.AreaEntered -= JumpScare_AreaEntered;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,4 +85,12 @@ public partial class Overworld : SpecialFloor, IDungeonFloor
|
||||
|
||||
public override (Vector3 Rotation, Vector3 Position) GetPlayerSpawnPoint() { return (PlayerSpawnPoint.Rotation, new Vector3(PlayerSpawnPoint.GlobalPosition.X, 2.4f, PlayerSpawnPoint.GlobalPosition.Z)); }
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
Exit.AreaEntered -= Exit_AreaEntered;
|
||||
RestoreArea.AreaEntered -= RestoreArea_AreaEntered;
|
||||
RestoreArea.AreaExited -= RestoreArea_AreaExited;
|
||||
RestoreTimer.Timeout -= RestoreTimer_Timeout;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user