Guest User

Untitled

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