Ejemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            if (nextWorld != null && World != nextWorld)
            {
                swapWorld();
            }

            IsInFocus = IsActive;

            InputManager.Update();
            RawKeyboardInput.Update();
            RawGamepadInput.Update();
            MouseReader.Update();

            Time.Set(gameTime);

            base.Update(gameTime);

            Console.Update();

            if (!Console.IsDisplaying && !PauseWorld)
            {
                UpdateGameplay();
            }

            Renderer.Update();
        }
Ejemplo n.º 2
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();
            }

            if (IsActive)
            {
                KeyboardReader.Update();
                MouseReader.Update();
            }

            base.Update(gameTime);
        }
        public void Update(GameTime gameTime, GameStateManager gameStateManager)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape) || escToggle)
            {
                escToggle = true;
                if (Keyboard.GetState().IsKeyUp(Keys.Escape))
                {
                    gameStateManager.SetState(GameStateManager.States.Playing);
                    escToggle = false;
                }
            }

            MouseReader.Update(gameTime);
            menu.Update(gameTime);
        }
 public void Update(GameTime gameTime, GameStateManager gameStateManager)
 {
     if (Keyboard.GetState().IsKeyDown(Keys.Escape) || escToggle)
     {
         escToggle = true;
         if (Keyboard.GetState().IsKeyUp(Keys.Escape))
         {
             gameStateManager.SetState(GameStateManager.States.Paused);
             escToggle = false;
         }
     }
     hero.Update(gameTime);
     level.Update(gameTime);
     hud.Update(gameTime);
     camera.MoveTo(-hero.Position.X);
     viewMatrix = camera.GetTransform();
     MouseReader.Update(gameTime);
 }