feat: coins and skills move to the new domain (commit B of the swap)
atomic pair - purchasing couples them, so neither moves alone. SkillData.Level is gone. It was an [Export] on a cached Resource: one instance per process, so the level never persisted, leaked between save slots, and made "unowned" indistinguishable from "level 1". Level now comes from the Playthrough and is passed to ISkill.Initialize. SkillManager reconciles from SkillSetChanged instead of being told by each caller. The old shape was "record it, then tell SkillManager" as two calls at four sites; AddSkill's early return when no player is registered left the skill owned but inert. Reconciliation also tracks the level each component was built at, so an upgrade rebuilds it rather than being patched in from outside. SkillUnlockerComponent collapses to one TryBuy - unlock and upgrade were two methods each doing affordability, debit, level mutation and manager notification in order. The guard three components copy-pasted around Upgrades[Level - 1] - and which BrickArmor omitted - now lives once in SkillComponentBase. Hud reads coins from CoinsChanged instead of rebuilding translated strings every frame. Lives still polls; it moves with the death path.
This commit is contained in:
@@ -116,15 +116,13 @@ public partial class GameManager : Node
|
||||
var seconds = SpeedRunManager?.GetCurrentLevelTime() ?? 0.0;
|
||||
LevelTime? time = seconds > 0 ? LevelTime.Of(seconds) : null;
|
||||
|
||||
// Old path: coins and skills earned this attempt.
|
||||
Store?.CommitSessionCoins();
|
||||
Store?.CommitSessionSkills();
|
||||
|
||||
EventBus.EmitLevelCompleted(IndexOf(finished), GetTree().CurrentScene, seconds);
|
||||
|
||||
// New path: banks, marks cleared, and advances campaign position if this was a first clear.
|
||||
// Banks the attempt's coins and skills, marks the level cleared, and advances campaign
|
||||
// position if this was a First Clear.
|
||||
Progression.FinishLevel(time);
|
||||
Store?.ResetSession();
|
||||
|
||||
// Still needed for lives, which move with the death path in the next commit.
|
||||
SaveSystem.Instance.SaveGame();
|
||||
|
||||
if (Progression.CurrentLevel is { } next && !next.Equals(finished))
|
||||
|
||||
Reference in New Issue
Block a user