Guest User

Untitled

a guest
Jan 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1.     static class GameState
  2.     {
  3.         public static GameStateEnum CurrentGameState;
  4.  
  5.         public static List<Block> Blocks = new List<Block>();
  6.  
  7.         public static enum GameStateEnum
  8.         {
  9.             Playing,
  10.             GameOver
  11.         }
  12.  
  13.         public static GameState(GameStateEnum gameState)
  14.         {
  15.             CurrentGameState = gameState;
  16.         }
  17.  
  18.         public static void AddBlock()
  19.         {
  20.             Block newBlock = new Block();
  21.             Blocks.Add(newBlock);
  22.         }
  23.  
  24.         public static void AddBlock(Block.BlockType blockType)
  25.         {
  26.             Block newBlock = new Block(blockType);
  27.             Blocks.Add(newBlock);
  28.         }
  29.  
  30.         public static void DrawBlocks(GameTime gameTime, SpriteBatch spriteBatch)
  31.         {
  32.             foreach (Block block in Blocks)
  33.             {
  34.                 if (block.Visible)
  35.                 {
  36.                     for (int x = 0; x < block.Size; x++)
  37.                     {
  38.                         for (int y = 0; y < block.Size; y++)
  39.                         {
  40.                             if (block.Layout[x, y] == true)
  41.                             {
  42.                                 spriteBatch.Draw(block.Texture, block.Texture.Width * new Vector2(block.X + x, block.Y + y), block.Color);
  43.                             }
  44.                         }
  45.                     }
  46.                 }
  47.             }
  48.         }
  49.     }
Add Comment
Please, Sign In to add comment