Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. public enum GameState
  2. {
  3.     MainMenu,
  4.     InGame,
  5.     GameOver
  6. };
  7.  
  8. class MyGame
  9. {
  10. /// snip
  11. protected GameState gameState = GameState.MainMenu;
  12.  
  13. protected override void Draw(GameTime gameTime)
  14. {
  15.     /// snip
  16.     switch(this.gameState)
  17.     {
  18.         case(GameState.MainMenu):
  19.  
  20.         break;
  21.         // same for all the others
  22.  
  23.         default:
  24.             throw new Exception("oh noes");
  25.         break;
  26.  
  27.     }
  28. }
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement