Example #1
0
 protected override void Update(GameTime gameTime)
 {
     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
     {
         Exit();
     }
     //scene2.Update(gameTime);
     if (the_menu != null)
     {
         the_menu.Update(gameTime);
         if (the_menu.isNewGamePressed())
         {
             SetScene1();
         }
         else if (the_menu.isContinueGamePressed())
         {
             SetFileLevel();
         }
         else if (the_menu.isExitPressed())
         {
             Exit();
         }
     }
     if (the_game_over != null)
     {
         the_game_over.Update(gameTime);
         if (the_game_over.isMainMenuPressed())
         {
             SetMainMenu();
         }
         else if (the_game_over.isRestartPressed())
         {
             SetFileLevel();
         }
     }
     if (the_win_menu != null)
     {
         the_win_menu.Update(gameTime);
         if (the_win_menu.isMainMenuPressed())
         {
             SetMainMenu();
         }
     }
     if (scene1 != null)
     {
         if (!scene1.Lost())
         {
             scene1.Update(gameTime);
         }
         else
         {
             SetGameOver();
         }
     }
     if (scene2 != null)
     {
         if (!scene2.Lost())
         {
             scene2.Update(gameTime);
         }
         else
         {
             SetGameOver();
         }
     }
     if (scene3 != null)
     {
         if (!scene3.Lost())
         {
             scene3.Update(gameTime);
         }
         else
         {
             SetGameOver();
         }
     }
     CheckIfSceneIsWonAndChange();
     BasicGUIButton.UpdateLimitForNextPressing(gameTime);
     //the_game_over_menu.Update(gameTime);
     //scene1.Update(gameTime);
     //scene2.Update(gameTime);
     //scene3.Update(gameTime);
     // TODO: Add your update logic here
     base.Update(gameTime);
 }