Add game scene and level catalog interfaces, and implement scene management in AppRoot

This commit is contained in:
2025-08-15 03:04:21 +02:00
parent 406036504a
commit 2cc54f7b37
14 changed files with 194 additions and 21 deletions

View File

@@ -1,6 +1,21 @@
using Mr.BrickAdventures.game.repositories;
namespace Mr.BrickAdventures.game.services;
public sealed class LevelService
{
private readonly LevelRepository _levels;
public LevelService(LevelRepository levels) => _levels = levels;
public int CompleteAndAdvance() {
var cur = _levels.Current;
_levels.Complete(cur);
var next = cur + 1;
_levels.SetCurrent(next);
return next;
}
public void StartNew() {
_levels.Load(new LevelState { Current = 0, Unlocked = new [] { 0 }, Completed = [] });
}
}