コード例 #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)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _inputListner.Update(gameTime);

            _previousKeyboardState = _currentKeyboardState;
            _previousMouseState    = _currentMouseState;
            _previousGamePadState  = _currentGamePadState;

            _currentGamePadState  = GamePad.GetState(PlayerIndex.One);
            _currentKeyboardState = Keyboard.GetState();
            _currentMouseState    = Mouse.GetState();

            UpdatePlayer(gameTime);

            _bgLayer1.Update(gameTime);
            _bgLayer2.Update(gameTime);

            UpdateEnemies(gameTime);
            UpdateCollision();

            UpdateLaserBeams(gameTime);
            UpdateExplosions(gameTime);

            base.Update(gameTime);
        }
コード例 #2
0
ファイル: Level.cs プロジェクト: Heroes-Global/Game-of-Life
        public override void Update(GameTime gameTime)
        {
            _fsm.PerformLogic(gameTime, _gameInfo);
            _konami.Update(Keyboard.GetState(), _konami.i, _konami);
            _teleport.Update(Keyboard.GetState(), _teleport.i, _teleport);
            base.Update(gameTime);


            if (_previousAdminMode == Constants.Editing.IsAdminMode || !_gameStarted)
            {
                return;
            }
            _previousAdminMode = Constants.Editing.IsAdminMode;
            if (_previousAdminMode)
            {
                HUDSystem.Add(_debugWidget);
            }
            else
            {
                HUDSystem.Remove(_debugWidget);
            }
        }