예제 #1
0
 public void ChangeState(GameState _state)
 {
     if (_current_states.Count != 0)
     {
         _current_states.Pop().Cleanup();
     }
     _current_states.Push(_state);
     _current_states.Peek().Init();
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 public void PushState(GameState _state)
 {
     if (_current_states.Count != 0)
     {
         _current_states.Peek().Pause();
     }
     _current_states.Push(_state);
     _current_states.Peek().Init();
 }
예제 #4
0
 public void PopState(GameState _state)
 {
     if (_current_states.Count != 0)
     {
         _current_states.Pop().Cleanup();
     }
     if (_current_states.Count != 0)
     {
         _current_states.Peek().Resume();
     }
 }