refactor: fix bugs and improve architecture

- Fix double-execution bug in LevelStateHandler (coins/skills were committed twice per level)
- Fix DamageComponent to track multiple targets via HashSet instead of single node
- Fix HealthComponent: update health immediately, decouple from PlayerController via signal wiring in PlayerController
- Remove dead loop in SkillManager.RemoveSkill; simplify O(n²) throw skill loop
- Replace GetNode<T>(path) with .Instance across managers; add Instance to StatisticsManager/SpeedRunManager
- GameManager.GetPlayer() now uses EventBus.PlayerSpawned instead of scanning all scene nodes
- UIManager.UiStack: remove [Export], use private List<Control>
- PlayerState: extract DefaultLives constant, simplify CreateDefault()
This commit is contained in:
2026-03-19 01:41:14 +01:00
parent 427bef6509
commit 321905e68e
11 changed files with 85 additions and 161 deletions

View File

@@ -5,6 +5,11 @@ namespace Mr.BrickAdventures.Autoloads;
public partial class SpeedRunManager : Node
{
public static SpeedRunManager Instance { get; private set; }
public override void _EnterTree() => Instance = this;
public override void _ExitTree() { if (Instance == this) Instance = null; }
public bool IsRunning { get; private set; } = false;
public bool IsVisible { get; private set; } = false;