Пример #1
0
        public void Update(GameTime gameTime)
        {
            if ((GameLoop.gameInstance.parameterLevelToLoad != null) && (currentGameState != GameState.InGame))
            {
                this.levelPath = GameLoop.gameInstance.parameterLevelToLoad;
                currentLevel   = Level.LoadLevelFile(GameLoop.gameInstance.parameterLevelToLoad);
                currentLevel.Initialize(false, GameLoop.gameInstance.Content);
                currentLevel.LoadContent();
                currentGameState = GameState.InGame;
                GameLoop.gameInstance.parameterLevelToLoad = null;
                return;
            }
            GameStateManager.kstate = Keyboard.GetState();
            if (currentGameState == GameState.MainMenu)
            {
                mainMenuScreen.updateScreen(gameTime);
                mainMenuScreen.playMenuMusic();
            }

            if (currentGameState == GameState.InGame)
            {
                if (!reallyWantToQuit)
                {
                    currentLevel.Update(gameTime);
                }
                else
                {
                    quitScreen.updateScreen(gameTime);
                    oldkstate = kstate;
                    //need this as a fix for botched up gamestate
                }


                if (kstate.IsKeyDown(Keys.Escape) && oldkstate.IsKeyUp(Keys.Escape))
                {
                    reallyWantToQuit = true;
                }
            }

            if (currentGameState == GameState.Menu)
            {
                menuScreen.updateScreen(gameTime);
            }
            if (currentGameState == GameState.PlayingCutscene)
            {
                if (kstate.IsKeyDown(Keys.Escape) && oldkstate.IsKeyUp(Keys.Escape))
                {
                    VideoManager.Container[VideoManager.currentlyPlaying].stop();
                }
            }

            GameStateManager.oldkstate = GameStateManager.kstate;

            //check wheter the LoadLevel option has been set:
        }