Пример #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            GameStateMachine.Instance.Update(gameTime);
            camera.Update(gameTime);
            playerOneController.Update();

            if (!Level.Instance.IsOnePlayer)
            {
                //playerTwoController.Update();
            }

            background.Update();
            base.Update(gameTime);
        }
Пример #2
0
        protected override void Update(GameTime gameTime)
        {
            switch (_currentGameState)
            {
            case GameState.STARTSCREEN:
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.MAINMENU:
                _camera.SetPosition(new Vector2(400, 240));
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.OPTIONSMENU:
                _camera.SetPosition(new Vector2(400, 240));
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.HIGHSCORE:
                _camera.SetPosition(new Vector2(400, 240));
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.LOADMENU:
                _camera.SetPosition(new Vector2(400, 240));
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.MAPEDIT:
                _camera.SetPosition(_mapEditor.CameraMovement());
                CheckGameState(_mapEditor.Update());
                break;

            case GameState.CREDIT:
                _camera.SetPosition(new Vector2(400, 240));
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.PLAYING:
                _camera.SetPosition(_gameManager._player._location);
                CheckGameState(_gameManager.Update(gameTime));
                _background.Update();    //reuires a value to say if its moving left or right or standing still
                break;

            case GameState.PAUSE:
                _camera.SetPosition(new Vector2(400, 240));
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.ENDSCREEN:
                _camera.SetPosition(new Vector2(400, 240));
                CheckGameState(_menuManager.Update(gameTime, _currentGameState.ToString()));
                break;

            case GameState.QUIT:
                Exit();
                break;
            }

            base.Update(gameTime);
        }