- 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()
30 lines
835 B
C#
30 lines
835 B
C#
using Godot;
|
|
using Mr.BrickAdventures.Autoloads;
|
|
|
|
namespace Mr.BrickAdventures.scripts.Events;
|
|
|
|
/// <summary>
|
|
/// Handles level completion events and updates GameStateStore.
|
|
/// </summary>
|
|
public partial class LevelStateHandler : Node
|
|
{
|
|
public override void _Ready()
|
|
{
|
|
EventBus.Instance.LevelCompleted += OnLevelCompleted;
|
|
}
|
|
|
|
public override void _ExitTree()
|
|
{
|
|
if (EventBus.Instance != null)
|
|
{
|
|
EventBus.Instance.LevelCompleted -= OnLevelCompleted;
|
|
}
|
|
}
|
|
|
|
private void OnLevelCompleted(int levelIndex, Node currentScene, double completionTime)
|
|
{
|
|
// State mutations (commit coins/skills, reset session) are handled by GameManager.OnLevelComplete
|
|
// before this event fires. This handler is reserved for future level-specific side-effects.
|
|
}
|
|
}
|