Grid Manager


Sets up and manages the grid that is associated with the playing field. This grid is used for AI movement and behaviors. In each grid block, the block will contain a varying level of degree that determines how much movement and fire has taken place in that square with action and movement from the player being more heavily weighted than that of an AI. This will then be sent to the AI which will determine what to do based off of these grid blocks. The 'action' will be the Z value of the Vector3 grid, where the X and Y will be the middle position of the grid block. The action will gradually dissipate over time till it reaches zero.



  • Vector3[,] grid - Grid that carries the data and positions that correspond to the level section.
  • float gridSize - size of array


  • ChangeGrid(Vector2 startingPosition, Vector2 endingPosition)
    • changes the grid (changes the X and Y to new values) to a different level section's grid (either bigger or smaller) and calls Reset() to make all the Z's go back to 0.
  • Reset()
    • Sets all Z's back to 0
  • GridManager()
    • Initializes Grid to for x, y and sets all z to 0
  • AddActionToGridBlock(float degree, Vector2 gridPosition)
    • Called by Player class and Enemy class anytime they make an action (movement/spell) and how big the action is. Will update the grid with their action.
  • Update(GameTime dt)
    • Updates the grid to gradually dissipate any action back to zero
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License