using Chickensoft.Introspection; using Chickensoft.LogicBlocks; namespace Zennysoft.Ma.Godot.Adapter; public partial class GameLogic { [Meta] public abstract partial record State : StateLogic { protected State() { OnAttach(() => { var gameRepo = Get(); gameRepo.IsPaused.Sync += OnIsPaused; gameRepo.DoubleExpTimeStart += OnDoubleExpTimeStart; gameRepo.Ended += OnGameEnded; }); OnDetach(() => { var gameRepo = Get(); gameRepo.IsPaused.Sync -= OnIsPaused; gameRepo.DoubleExpTimeStart -= OnDoubleExpTimeStart; gameRepo.Ended -= OnGameEnded; }); } private void OnDoubleExpTimeStart(int lengthOfTimeInSeconds) => Output(new Output.DoubleExpTimeStart(lengthOfTimeInSeconds)); private void OnGameEnded() => Output(new Output.ShowLostScreen()); public void OnIsPaused(bool isPaused) => Output(new Output.SetPauseMode(isPaused)); } }