Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
Exemplo n.º 1
0
        protected GameState(Game game, GameStateManager manager)
            : base(game)
        {
            StateManager = manager;

            _childComponents = new List<GameComponent>();
            tag = this;
        }
Exemplo n.º 2
0
        public void PushState(GameState newState)
        {
            _drawOrder += DrawOrderInc;
            newState.DrawOrder = _drawOrder;

            AddState(newState);

            if (OnStateChange != null)
                OnStateChange(this, null);
        }
Exemplo n.º 3
0
        public void ChangeState(GameState newState)
        {
            while (_gameStates.Count > 0)
                RemoveState();

            newState.DrawOrder = StartDrawOrder;
            _drawOrder = StartDrawOrder;

            AddState(newState);

            if (OnStateChange != null)
                OnStateChange(this, null);
        }
Exemplo n.º 4
0
        private void AddState(GameState newState)
        {
            _gameStates.Push(newState);

            Game.Components.Add(newState);

            OnStateChange += newState.StateChange;
        }