Beispiel #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)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            base.Update(gameTime);
            aiEngine.Update(gameTime);
        }
Beispiel #2
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (Keyboard.GetState().IsKeyDown(Keys.Home) || GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Back))
            {
                this.Exit();
            }

            inputEngine.Update();

            if (currentState == GameState.MenuScreen)
            {
                menuEngine.Update(gameTime);
            }
            else
            {
                pickupEngine.Update(gameTime);
                foreach (Player player in players)
                {
                    player.Update(gameTime);
                }

                /*if (players.Length == 1)
                 *  players[0].Update(gameTime);
                 * else {
                 *  playerUpdateAlt = !playerUpdateAlt;
                 *  int start = (playerUpdateAlt ? 1 : 0);
                 *  bool fake = false;
                 *  for (int i = 0; i < players.Length; i++) {
                 *      if (fake)
                 *          players[(i+start) % players.Length].fakeUpdate(gameTime);
                 *      else
                 *          players[(i+start) % players.Length].Update(gameTime);
                 *      fake = !fake;
                 *  }
                 * }*/

                aiEngine.Update(gameTime);
                renderEngine.Update(gameTime);
                //roundTime = initialRoundTime - gameTime.TotalGameTime.Seconds + roundStartTime;
                roundTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            }

            base.Update(gameTime);
        }