39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using Chickensoft.Introspection;
|
|
using Chickensoft.LogicBlocks;
|
|
|
|
namespace GameJamDungeon
|
|
{
|
|
public partial class GameLogic
|
|
{
|
|
public partial record State
|
|
{
|
|
[Meta]
|
|
public partial record Playing : State,
|
|
IGet<Input.OpenInventory>,
|
|
IGet<Input.MiniMapButtonPressed>,
|
|
IGet<Input.GameOver>,
|
|
IGet<Input.AskForTeleport>,
|
|
IGet<Input.PauseGame>
|
|
{
|
|
public Playing()
|
|
{
|
|
this.OnEnter(() => Get<IGameRepo>().Ended += OnEnded);
|
|
this.OnExit(() => Get<IGameRepo>().Ended -= OnEnded);
|
|
}
|
|
|
|
public void OnEnded() => Input(new Input.GameOver());
|
|
|
|
public Transition On(in Input.OpenInventory input) => To<InventoryOpened>();
|
|
|
|
public Transition On(in Input.MiniMapButtonPressed input) => To<MinimapOpen>();
|
|
|
|
public Transition On(in Input.GameOver input) => To<Quit>();
|
|
|
|
public Transition On(in Input.AskForTeleport input) => To<AskForTeleport>();
|
|
|
|
public Transition On(in Input.PauseGame input) => To<Paused>();
|
|
}
|
|
}
|
|
}
|
|
}
|