コード例 #1
0
        protected override void Update(GameTime gameTime)
        {
            GameTime = gameTime;
            Input.Update();

            // Allows the game to exit
            if (Input.WasButtonPressed(Buttons.Back) || Input.WasKeyPressed(Keys.Escape))
            {
                this.Exit();
            }

            if (Input.WasKeyPressed(Keys.P))
            {
                paused = !paused;
            }
            if (Input.WasKeyPressed(Keys.B))
            {
                useBloom = !useBloom;
            }

            if (!paused)
            {
                PlayerStatus.Update();
                EntityManager.Update();
                EnemySpawner.Update();
                ParticleManager.Update();
                Grid.Update();
            }

            base.Update(gameTime);
        }
コード例 #2
0
ファイル: GameRoot.cs プロジェクト: saniainf/TestMonoGame
 /// <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)
 {
     GameTime = gameTime;
     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
     {
         Exit();
     }
     EntityManager.Update();
     Input.Update();
     EnemySpawner.Update();
     PlayerStatus.Update();
     base.Update(gameTime);
 }