32 lines
852 B
C#
32 lines
852 B
C#
using Chickensoft.Introspection;
|
|
using Chickensoft.LogicBlocks;
|
|
|
|
namespace Zennysoft.Game.Ma.Implementation;
|
|
|
|
public partial class GameLogic
|
|
{
|
|
[Meta]
|
|
public abstract partial record State : StateLogic<State>
|
|
{
|
|
protected State()
|
|
{
|
|
OnAttach(() =>
|
|
{
|
|
var gameRepo = Get<IGameRepo>();
|
|
gameRepo.IsPaused.Sync += OnIsPaused;
|
|
gameRepo.DoubleExpTimeStart += OnDoubleExpTimeStart;
|
|
});
|
|
OnDetach(() =>
|
|
{
|
|
var gameRepo = Get<IGameRepo>();
|
|
gameRepo.IsPaused.Sync -= OnIsPaused;
|
|
gameRepo.DoubleExpTimeStart -= OnDoubleExpTimeStart;
|
|
});
|
|
}
|
|
|
|
private void OnDoubleExpTimeStart(int lengthOfTimeInSeconds) => Output(new Output.DoubleExpTimeStart(lengthOfTimeInSeconds));
|
|
|
|
public void OnIsPaused(bool isPaused) => Output(new Output.SetPauseMode(isPaused));
|
|
}
|
|
}
|