public GameState(Game game, GameStateManager manager) : base(game) { StateManager = manager; gameComponents = new List<GameComponent>(); Id = this; }
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; }