Beispiel #1
0
        protected override void Update(GameTime gameTime)
        {
            debugTimer   += gameTime.ElapsedGameTime.TotalSeconds; // delay for debug display toggle
            Global.timer += gameTime.ElapsedGameTime.TotalSeconds; // 1 second delay in between World Select button checks
            if (Global.debugMode)
            {
                debug.Update(gameTime, area, player);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }
            switch (Global.screen)
            {
            case -1:     // during world generation
                #region World Generation
                world.GenerateWorld();
                #endregion
                break;

            case 0:     // main menu
                #region Main Menu
                foreach (Button button in mainMenuButtons)
                {
                    button.Update(gameTime);
                }
                #endregion
                break;

            case 1:     // world select

                #region World Select
                if (worldToLoad != 0)
                {
                    world.Update(player, area);
                }
                foreach (Button button in worldSelectButtons)
                {
                    button.Update(gameTime);
                }
                #endregion
                break;

            case 2:     // play
                #region Play
                foreach (Button button in playButtons)
                {
                    button.Update(gameTime);
                }
                world.Update(player, area);
                btnSaveAndExit.Update(gameTime);
                ui.Update(gameTime, player);
                KeyboardInput();
                MouseInput(gameTime);
                area.Update(gameTime, player);
                player.Update(gameTime, area, playButtons[1]);
                if (Global.displayBook)
                {
                    crafting.Update(gameTime, player);
                    btnBookCreate.Update(gameTime);
                    btnBookCreate2.Update(gameTime);
                    btnBookExit.Update(gameTime);
                    btnArrowLeft.Update(gameTime);
                    btnArrowRight.Update(gameTime);
                }
                #endregion
                break;
            }

            base.Update(gameTime);
        }