Overhaul game state logic to support gameplay loop

This commit is contained in:
2025-04-30 00:43:55 -07:00
parent 78cdda97b9
commit 68c91d8f13
60 changed files with 2503 additions and 1116 deletions

View File

@@ -0,0 +1,32 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
using Zennysoft.Game.Abstractions;
namespace Zennysoft.Ma.Adapter;
public partial class AppLogic
{
public partial record State
{
[Meta]
public partial record GameStarted : State
{
public GameStarted()
{
this.OnEnter(() =>
{
Output(new Output.SetupGameScene());
Output(new Output.ShowGame());
Get<IAppRepo>().OnEnterGame();
});
this.OnExit(() => Output(new Output.HideGame()));
OnAttach(() => Get<IAppRepo>().GameExited += OnGameExited);
OnDetach(() => Get<IAppRepo>().GameExited -= OnGameExited);
}
public void OnGameExited() => Input(new Input.QuitGame());
}
}
}