Update() private method

private Update ( ) : void
return void
コード例 #1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            KeyboardState pauseButton = Keyboard.GetState();

            if (pauseButton.IsKeyDown(Keys.P))
            {
                _pauseGame = false;
            }
            CheckLivingEntityCollision(_player);
            if (!_pauseGame)
            {
                if (gc.CurrentLevel == 1 && gc.LevelFinished)
                {
                    gc.LevelFinished = false;
                    gc.CurrentLevel  = 2;
                    _board           = new Board(_spriteBatch, _tileTexture, 59, 25);
                    _board.CreateNewBossBoard();

                    _player.Position = new Vector2(50, ScreenHeight - (TileHeight * 2));
                    _geryon.Position = new Vector2(ScreenWidth - (TileWidth * 2), ScreenHeight - (TileHeight * 2));
                }

                base.Update(gameTime);
                background1.Update(gameTime);
                _player.Update(gameTime);
                _vortex.Update(gameTime, _player);

                _spawn += (float)gameTime.ElapsedGameTime.TotalSeconds;
                foreach (Enemy demon in _demonHorde)
                {
                    demon.Update(gameTime, _player);
                }
                if (gc.CurrentLevel == 1)
                {
                    LoadEnemies();
                }

                for (int i = 0; i < gc.MaxScoreCount; i++)
                {
                    _coins[i].Update(gameTime, _player);
                }
                if (gc.CurrentLevel == 2)
                {
                    _geryon.Update(gameTime, _player);
                    _healthRectangle = new Rectangle(ScreenWidth / 2, ScreenHeight / 10, _geryon.Health, 20);
                    CheckWinCondition();
                }
            }
        }
コード例 #2
0
ファイル: Level1.cs プロジェクト: gkericks/legend-of-darwin
        private void UpdateLevelState(GameTime gameTime)
        {
            if (darwin.isZombie() && darwin.isDarwinAlive())
            {
                if (zTime.isTimedOut())
                {
                    gameOver = true;
                }
                else
                {
                    zTime.Update(gameTime);
                }
            }

            KeyboardState ks = Keyboard.GetState();

            checkForExitGame(ks);

            updateKeyHeldDown(ks);

            // only check for deaths if neccessary
            if (darwin.isDarwinAlive())
            {
                if (!darwin.isZombie())
                {
                    checkForGameOver(firstZombie);
                    checkForGameOver(secondZombie);
                    checkForGameOver(thirdZombie);
                    checkForGameOver(fourthZombie);
                    checkForGameOver(fifthZombie);
                    checkForGameOver(sixthZombie);
                }
                checkForGameOver(vortex);

                darwin.Update(gameTime, ks, board, darwin.X, darwin.Y);
            }

            stairs.Update(gameTime, darwin);

            firstZombie.Update(gameTime, darwin, brain);
            secondZombie.Update(gameTime, darwin, brain);
            thirdZombie.Update(gameTime, darwin, brain);
            fourthZombie.Update(gameTime, darwin, brain);
            fifthZombie.Update(gameTime, darwin, brain);
            sixthZombie.Update(gameTime, darwin, brain);

            firstSwitch.Update(gameTime, ks, darwin);

            brain.Update(gameTime, ks, darwin);

            vortex.Update(gameTime, ks);
            vortex.CollisionWithZombie(firstZombie);
            vortex.CollisionWithZombie(secondZombie);
            vortex.CollisionWithZombie(thirdZombie);
            vortex.CollisionWithZombie(fourthZombie);
            vortex.CollisionWithZombie(fifthZombie);
            vortex.CollisionWithZombie(sixthZombie);
            vortex.CollisionWithBO(brain, board);

            potion.Update(gameTime, ks, darwin, zTime);

            //checkForGameWin();
            checkForSwitchToLevelTwo();

            if (ks.IsKeyDown(Keys.H) && messageModeCounter > 10)
            {
                messageMode        = true;
                messageModeCounter = 0;
            }
            messageModeCounter++;
        }