public void PushState(GameState newState) { _drawOrder += DrawOrderInc; newState.DrawOrder = _drawOrder; AddState(newState); if (OnStateChange != null) OnStateChange(this, null); MakeVisible(); }
public void ChangeState(GameState newState) { while (_gameStates.Count > 0) RemoveState(); newState.DrawOrder = StartDrawOrder; _drawOrder = StartDrawOrder; AddState(newState); if (OnStateChange != null) OnStateChange(this, null); }
private void AddState(GameState newState) { _gameStates.Push(newState); Game.Components.Add(newState); OnStateChange += newState.StateChange; }