Ejemplo n.º 1
0
        public void Update(UpdateState state)
        {
            //when a button is pressed, load the game..
            //Note the player index selected in the startup screen is used here...
            Xen.Input.State.InputState input = state.PlayerInput[this.stateManager.PlayerIndex].InputState;

            if (input.Buttons.A.OnReleased ||
                input.Buttons.B.OnReleased ||
                input.Buttons.X.OnReleased ||
                input.Buttons.Y.OnReleased)
            {
                //we want to start playing the game!

                //create a new game to play.
                IProgressGameState gameState = new PlayingState(this.stateManager.Application);

                //load the game, through a LoadingState
                IGameState loadingState = new LoadingState(gameState);

                //go to the loading state.
                this.stateManager.SetState(loadingState);
                return;
            }

            if (input.Buttons.Back.OnPressed)
            {
                //quit when back is pressed in the menu
                this.stateManager.Application.Shutdown();
                return;
            }
        }
Ejemplo n.º 2
0
		public void Update(UpdateState state)
		{
			//when a button is pressed, load the game..
			//Note the player index selected in the startup screen is used here...
			Xen.Input.State.InputState input = state.PlayerInput[this.stateManager.PlayerIndex].InputState;

			if (input.Buttons.A.OnReleased ||
				input.Buttons.B.OnReleased ||
				input.Buttons.X.OnReleased ||
				input.Buttons.Y.OnReleased)
			{
				//we want to start playing the game!

				//create a new game to play.
				IProgressGameState gameState = new PlayingState(this.stateManager.Application);

				//load the game, through a LoadingState
				IGameState loadingState = new LoadingState(gameState);

				//go to the loading state.
				this.stateManager.SetState(loadingState);
				return;
			}

			if (input.Buttons.Back.OnPressed)
			{
				//quit when back is pressed in the menu
				this.stateManager.Application.Shutdown();
				return;
			}
		}