Advertisement
Loloped

Untitled

Jul 8th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1. protected override void Draw(GameTime gameTime)
  2.         {
  3.             GraphicsDevice.Clear(Color.Green);
  4.  
  5.             #region SpriteBatch Begin-End
  6.             spriteBatch.Begin();
  7.             if (gameScene.name == "game")
  8.             {
  9.                 foreach (var gameObject in bulletObjects)
  10.                 {
  11.                     gameObject.Draw(spriteBatch);
  12.                 }
  13.  
  14.                 foreach (var scenicObject in scenicObjects)
  15.                 {
  16.                     scenicObject.Draw(spriteBatch);
  17.                 }
  18.  
  19.  
  20.                 foreach (var panzerObject in panzerObjects)
  21.                 {
  22.                     panzerObject.Draw(spriteBatch);
  23.                 }
  24.             }
  25.             foreach (GameObjects.Buttons btn in buttonObjects)
  26.                 {
  27.                     btn.Update(); // Обновляем состояние кнопки
  28.                     if (btn.pressed)
  29.                     {
  30.                         if (btn.name == "start") // Если мы нажали на кнопку "Начать игру", то можно уже отрисовывать другие объекты
  31.                         {
  32.                             gameScene.name = "game";
  33.                             btn.enabled = false;
  34.                         }
  35.                     }
  36.                     if (btn.enabled)
  37.                     {
  38.                         btn.Draw(spriteBatch);
  39.                     }
  40.                 }
  41.            
  42.  
  43.  
  44.  
  45.             if (gameScene != null && gameScene.name == "game")
  46.             {
  47.                 this.IsMouseVisible = false;
  48.             }
  49.             else
  50.             {
  51.                 spriteBatch.Draw(blue_cursor.Texture, cursor_coords, Color.White); // Рисуем курсор
  52.             }
  53.  
  54.             spriteBatch.End();
  55.             base.Draw(gameTime);
  56.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement