protected GameState(Game game, GameStateManager manager)
     : base(game)
 {
     this.stateManager = manager;
     this.childComponents = new List<GameComponent>();
     this.tag = this;
 }
        public void ChangeState(GameState newState)
        {
            while (this.gameStates.Count > 0)
            {
                this.RemoveState();
            }

            newState.DrawOrder = startDrawOrder;
            this.drawOrder = startDrawOrder;

            this.AddState(newState);

            if (this.OnStateChange != null)
            {
                this.OnStateChange(this, null);
            }
        }
        public void PushState(GameState newState)
        {
            this.drawOrder += drawOrderInc;
            newState.DrawOrder = this.drawOrder;

            AddState(newState);

            if (this.OnStateChange != null)
            {
                this.OnStateChange(this, null);
            }
        }
        private void AddState(GameState newState)
        {
            this.gameStates.Push(newState);

            this.Game.Components.Add(newState);

            this.OnStateChange += newState.StateChange;
        }