Overhaul game state logic to support gameplay loop
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
public partial class GameState
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, LogicBlock(typeof(State), Diagram = true)]
|
||||
public partial record MainMenu : State, IGet<Input.NewGame>, IGet<Input.ContinueGame>, IGet<Input.LoadGame>
|
||||
{
|
||||
public Transition On(in Input.NewGame input)
|
||||
{
|
||||
Output(new Output.InitializeGame());
|
||||
return To<InGame>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.ContinueGame input)
|
||||
{
|
||||
Output(new Output.InitializeGame());
|
||||
return To<InGame>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.LoadGame input)
|
||||
{
|
||||
Output(new Output.LoadGameFromFile());
|
||||
return To<InGame>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user