refactor: enhance GameStateStore integration and improve skill management

This commit is contained in:
2026-03-19 02:33:07 +01:00
parent 3e36e48e97
commit eeefca4d4e
31 changed files with 260 additions and 419 deletions

View File

@@ -11,7 +11,7 @@ namespace Mr.BrickAdventures.Autoloads;
public partial class SkillManager : Node
{
private PlayerController _player;
private GameManager GameManager => GameManager.Instance;
private GameStateStore Store => GameStateStore.Instance;
[Export] public Array<SkillData> AvailableSkills { get; set; } = [];
@@ -154,18 +154,14 @@ public partial class SkillManager : Node
public void ApplyUnlockedSkills()
{
if (_player == null || !IsInstanceValid(_player)) return;
if (GameManager == null) return;
if (Store == null) return;
foreach (var sd in AvailableSkills)
{
if (GameManager.IsSkillUnlocked(sd))
{
if (Store.IsSkillUnlocked(sd))
CallDeferred(MethodName.AddSkill, sd);
}
else
{
RemoveSkill(sd.Name);
}
}
}