Main Controller for game
More...
|
static Game | Instance [get, set] |
|
§ Game()
Constructor for the game. Sets Instance to the current game along with initializing XNA features such as GraphicsDeviceManager, Height, Width, Content Loader, and the different menu screens.
§ Draw()
override void Controller.Game.Draw |
( |
GameTime |
gameTime | ) |
|
|
protected |
Draws the game as it updates at 60FPS
Draw Components that move with : *Note: Many draw methods although called here will not perform any action should the conditions to draw it not be met.
- Start spriteBatch.begin, pass in camera transform matrix.
- Draws background texture.
- Draws all units for both players.
- Draws damage popup.
- If a unit is currently selected and isAnimating is false:
- draw highlightable nodes.
- draw dropDownMenu if dropDownMenuOpen is true.
- Draws inventory drop down menu if inventoryOpen is true.
- redraws unit to be darker at gameOver (method won't redraw unless game is over).
- Draws end turn confirmation button.
Draw Components that are fixed to \ screen: *Note: Many draw methods although called here will not perform any action should the conditions to draw it not be met.
- If a unit is currently selectedand if attackConfirm is true, draw attackConfirm texture.
- If enemy unit is selected, draw enemy unit info.
- If turnTransition is true, draw the correct turn transition image.
- If it is not game over, draw the label for the current player's turn.
- If it is game over, draw the game over overlay image and buttons.
- Parameters
-
gameTime | The current Game Time |
§ getSong()
SoundEffectInstance Controller.Game.getSong |
( |
string |
choice | ) |
|
This method takes in a string, and returns the song corresponding to the string input. The songs returned are Menu, Map, and gameOverSong.
§ getSounds()
SoundEffect Controller.Game.getSounds |
( |
string |
choice | ) |
|
This method takes in a string, and returns the correct sound effect corresponding to the string input. The sounds returned are Sword, Bow, and Fire.
§ Initialize()
override void Controller.Game.Initialize |
( |
| ) |
|
|
protected |
initializes game. The Game screen is invisible until the Menu screen is closed
§ LoadContent()
override void Controller.Game.LoadContent |
( |
| ) |
|
|
protected |
This method Loads all GUI and Map Textures, fonts, and SoundEffect Wav files. An instance is created for the wave files that are a song, then isLooped is set to true. Volume for the songs are also adjusted to half the original value. The method will then also call initializeGame() to set up the rest of the game.
§ Update()
override void Controller.Game.Update |
( |
GameTime |
gameTime | ) |
|
|
protected |
Updates game in real time at 60 times per second.
Update Components:
- Checks if player clicks exit on the exit window
- Calls MouseHandler to update mouse position if game is running
- A switch case is used to update the game depending on what current Game State is.
- During Game State Main Menu:
- Checks if start game button is clicked. In which case the main menu is closed, Menu Song is stopped, Map song is played, main game is set to visible, and Game State is set to Playing.
- Checks if get instruction button is clicked. In which case the gameState is switched to HowToPlay and instruction screen pops up.
- Checks if Exit Game is clicked, in which case the game closes.
- During Game State HowToPlay:
- Checks if next button is clicked. In such case, change game state to HowToPlay2, set the 2nd instruction screen to show, and close the current window
- Checks if back button is clicked. In such case, change game state to MainMenu, set the Main Menu to show, and close the current window
- Checks if Exit Game is clicked, in which case the game closes.
- During Game State HowToPlay2:
- Checks if next button is clicked. In such case, change game state to HowToPlay3, set the 2nd instruction screen to show, and close the current window
- Checks if back button is clicked. In such case, change game state to HowToPlay1, set the 2nd instruction screen to show, and close the current window
- Checks if Exit Game is clicked, in which case the game closes.
- During Game State HowToPlay3:
- Checks if back button is clicked. In such case, change game state to HowToPlay2, set the 2nd instruction screen to show, and close the current window
- Checks if Exit Game is clicked, in which case the game closes.
- During Game State Playing:
- Loads the map texture
- If GameFunction isTurnOver is true, switch the current player and other player, set turn transition to true, and reset the camera to the new current player's turn.
- If transition turn is true, set it to false after 1.5 seconds.
- If currentPlayerDamagePopUp is true, set it to false after 2.5 seconds.
- If enemyPlayerDamagePopUp is true, set it to false after 2.5 seconds.
- Loops over all player1 and 2's units, and removes the ones that are dead. If either player has no units left, isGameOver is set to true, and Song changes from map theme to Game over theme.
- Parameters
-
gameTime | The current Game Time |
The documentation for this class was generated from the following file:
- C:/Users/Thien Trandinh/Documents/Blaze-Brigade/src/Blaze-Brigade/Blaze_Brigade/Game.cs