public void ChangeState(GameState _state) { if (_current_states.Count != 0) { _current_states.Pop().Cleanup(); } _current_states.Push(_state); _current_states.Peek().Init(); }
public GameEngine(GameState InitialState=null) { _current_states = new Stack<GameState>(); IsRunning = true; _mediator_manager = new MediatorManager(new DefaultSubscribableManager()); if (InitialState != null) { InitialState.Mediator = Mediator; _current_states.Push(InitialState); } }
public void PushState(GameState _state) { if (_current_states.Count != 0) { _current_states.Peek().Pause(); } _current_states.Push(_state); _current_states.Peek().Init(); }
public void PopState(GameState _state) { if (_current_states.Count != 0) { _current_states.Pop().Cleanup(); } if (_current_states.Count != 0) { _current_states.Peek().Resume(); } }