Beispiel #1
0
        protected override void Update(GameTime gameTime)
        {
            tick++;
            updateMessage = "";
            inputState.set(Keyboard.GetState(), Mouse.GetState());

            if (needToResetUserInput)
            {
                needToResetUserInput = false;
                userInputList.Clear();
                userInputList.Add(console);
                userInputList.Add(inventory);
                if (currentWorld != null)
                {
                    if (currentWorld.player != null)
                    {
                        userInputList.Add(currentWorld.player.movement);
                    }
                }
            }

            foreach (InputUser i in userInputList)
            {
                inputState = i.update(this, inputState);
            }
            inputState.regergitateKeyboardAndMouse();

            if (inputState.down(Keys.X))
            {
                currentWorld.player.position.Y += 16;
            }

            if (inputState.pressed(Game.KEY_ESCAPE))
            {
                this.Exit();
            }
            if (inputState.pressed(Game.KEY_DEBUG_MENU))
            {
                debugEnabled = !debugEnabled;
            }

            SoundEffectPlayer.update();

            if (currentWorld != null)
            {
                currentWorld.Update(this, tick);
                if (inputState.getKeyboardState().IsKeyDown(Game.KEY_FAST_FORWARD_CLOCK))
                {
                    currentWorld.time += 10;
                }
            }

            EntityItem.playedSoundEffectRecently = false;

            inputState.setLast(Keyboard.GetState(), Mouse.GetState());
            base.Update(gameTime);
            updateFps.update();
        }