refactor: enhance GameStateStore integration and improve skill management
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user