Ejemplo n.º 1
0
        public override void Update(GameTime gameTime, StateManager screen, GamePadState gamePadState, MouseState mouseState, KeyboardState keyState, InputHandler input)
        {
            if (input.KeyboardState.WasKeyPressed(Keys.Escape) || input.WasPressed(0, InputHandler.ButtonType.B, Keys.B))
            {
                screen.Pop();
            }

            if (input.KeyboardState.WasKeyPressed(Keys.P) || input.WasPressed(0, InputHandler.ButtonType.Start, Keys.Tab))
            {
                PauseScreen pause = new PauseScreen();
                screen.Push(pause);
            }

            elapsedTime += gameTime.ElapsedGameTime;

            if (Keyboard.GetState().IsKeyDown(Keys.Up))
            {
                if (elapsedTime > TimeSpan.FromSeconds(2))
                {
                    if (lander.fuel > 0)
                    {
                        soundEffects[0].Play();
                    }

                    elapsedTime = TimeSpan.Zero;
                }
            }
            lander.Update(gameTime);
            fuelWord.Update("Fuel " + lander.fuel);
            lander.CreateLines();

            CollisionCheck();
        }