refactor
This commit is contained in:
@@ -2,6 +2,7 @@ using Godot;
|
||||
using Mr.BrickAdventures;
|
||||
using Mr.BrickAdventures.Autoloads;
|
||||
using Mr.BrickAdventures.scripts.interfaces;
|
||||
using Mr.BrickAdventures.scripts.State;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
@@ -34,7 +35,9 @@ public partial class ExitDoorComponent : Area2D, IUnlockable
|
||||
|
||||
EmitSignalExitTriggered();
|
||||
_achievementManager.UnlockAchievement(AchievementId);
|
||||
_gameManager.UnlockLevel((int)_gameManager.PlayerState["current_level"] + 1);
|
||||
// Get current level from GameStateStore
|
||||
var currentLevel = GameStateStore.Instance?.Session.CurrentLevel ?? 0;
|
||||
_gameManager.UnlockLevel(currentLevel + 1);
|
||||
CallDeferred(nameof(GoToNextLevel));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Mr.BrickAdventures;
|
||||
using Mr.BrickAdventures.Autoloads;
|
||||
using Mr.BrickAdventures.scripts.interfaces;
|
||||
using Mr.BrickAdventures.scripts.Resources;
|
||||
using Mr.BrickAdventures.scripts.State;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
@@ -38,8 +39,8 @@ public partial class SkillUnlockerComponent : Node
|
||||
skill.IsActive = true;
|
||||
_gameManager.RemoveCoins(skill.Upgrades[0].Cost);
|
||||
|
||||
var skillsUnlocked = (Array<SkillData>)_gameManager.CurrentSessionState["skills_unlocked"];
|
||||
skillsUnlocked.Add(skill);
|
||||
// Add to session state via GameStateStore
|
||||
GameStateStore.Instance?.UnlockSkillInSession(skill);
|
||||
SkillManager.AddSkill(skill);
|
||||
EmitSignalSkillUnlocked(skill);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user