Overhaul game state logic to support gameplay loop
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
public partial class GameState
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, LogicBlock(typeof(State), Diagram = true)]
|
||||
public partial record InGame : State,
|
||||
IGet<Input.InventoryButtonPressed>,
|
||||
IGet<Input.MiniMapButtonPressed>,
|
||||
IGet<Input.PauseButtonPressed>,
|
||||
IGet<Input.DebugButtonPressed>,
|
||||
IGet<Input.FloorExitEntered>,
|
||||
IGet<Input.GameOver>
|
||||
{
|
||||
public Transition On(in Input.InventoryButtonPressed input)
|
||||
{
|
||||
Output(new Output.OpenInventoryMenu());
|
||||
return To<InventoryScreen>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.MiniMapButtonPressed input)
|
||||
{
|
||||
Output(new Output.OpenMiniMap());
|
||||
return To<MiniMapScreen>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.PauseButtonPressed input)
|
||||
{
|
||||
Output(new Output.OpenPauseScreen());
|
||||
return To<PauseScreen>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.DebugButtonPressed input)
|
||||
{
|
||||
Output(new Output.OpenDebugMenu());
|
||||
return To<DebugMenu>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.FloorExitEntered input)
|
||||
{
|
||||
Output(new Output.OpenFloorExitScreen());
|
||||
return To<FloorExitScreen>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.GameOver input)
|
||||
{
|
||||
Output(new Output.GameOver());
|
||||
return To<GameOver>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user