Refactor UI components to inherit from Control and update node paths for consistency

This commit is contained in:
2025-08-26 16:20:01 +02:00
parent 1d4948e5b4
commit ca0d21e40a
84 changed files with 767 additions and 884 deletions

View File

@@ -18,6 +18,8 @@ public partial class ExitDoorComponent : Node, IUnlockable
public override void _Ready()
{
_gameManager = GetNode<GameManager>("/root/GameManager");
if (ExitArea == null)
{
GD.PushError("ExitDoorComponent: ExitArea is not set.");
@@ -26,12 +28,15 @@ public partial class ExitDoorComponent : Node, IUnlockable
ExitArea.BodyEntered += OnExitAreaBodyEntered;
_gameManager = GetNode<GameManager>("/root/gameManager");
}
private void OnExitAreaBodyEntered(Node2D body)
{
throw new System.NotImplementedException();
if (Locked) return;
EmitSignalExitTriggered();
_gameManager.UnlockLevel((int)_gameManager.PlayerState["CurrentLevel"] + 1);
CallDeferred(nameof(GoToNextLevel));
}
public void Unlock()