The GameManager will be in charge of updating and drawing all the gameplay components. The GameManager will also be in control of initializing and resetting itself for each level that will be played. It will initialize the camera, HUD, player, and effect manager when itself is initialized, but not the level manager. When loading a new level it will reset itself and all the components it maintains. First it will reset the LevelManager for the new level by giving it the level sections and having it set up the new pool manager. Next the Player will get reset to the starting position of the level. And finally the Camera and HUD will get reset based on the player. TargettingEnemy will also get reset to null. This class will also take care of possessing enemies including the targeting of enemies, telling the HUD when to display the graphics for soft possession, and if possession is successful then passing a reference of the enemy which got possessed to the player.


  • Camera : holds the camera. It is automatically updated because it's a game component. Updates based on the players position and it's transform matrix is used in the first spritebatch.Begin() call in the Draw method
  • Player : updates and draws all player components including updating/drawing its animation state and updating meter components
  • LevelManager : updates and draws everything in the level including enemies, level objects, and tiles. Also handles collision detection.
  • EffectsManager : updates and draws everything in the level related to particle effects and shaders
  • HUD : updates and draws everything on the HUD including health bars, ability icons, the possession meter, and enemy aura's


Will maintain an object for each component that is used for gameplay

  • const float SOUL_BODY_DECREMENT - amount to decrement from doing a soul-body possession
  • const float BODY_BODY_DECREMENT - amount to decrement from doing a body-body possession
  • AI ai - functions and routines for the AI in the game
  • bool isSoftPossessing - indicates whether the player is soft possessing or not
  • Enemy targetEnemy - the enemy onscreen which is currently targeted, null if one isn't
  • HUD hud - reference to the heads up display
  • int iter - looping iterator
  • LevelManager level - level manager that holds all the level information
  • SpriteFont font - font for drawing the possession gauge
  • Texture2D[] enemyPics - textures for the enemies
  • Texture2D enemyIndicator - texture for the enemy indicator
  • Texture2D possessionIndicator - texture for the possession indicator
  • Vector2 indicatorPosition - exact position for the enemy indicator
  • Vector2 indicatorOffset - offset from the player of the enemy
  • Vector2 fontOffset - font offset for teh possession gauge
  • WillRing willRing - the will ring for the soft possession mechanic
  • Camera camera
  • Player player
  • EffectManager effects


  • LevelStart
    • Initializes the components maintained by this. Performed at the beginning of the game.
    • Will be called at the start of the game
  • LevelReset
    • This method will reset itself and its components based on the data that is passed in by the loader. The loader will call this method after done loading in an xml so it can pass the level data in. The data it will get is an array of level sections, the players starting position,and the boss. The level sections and boss will get passed into the level manager via its Reset method. The player's starting position will get passed into the player's Reset method.
  • Update
    • Updates all of the components the GameManager is in control of in the following order : Player, LevelManager, EffectManager, HUD
  • Draw
    • Calls SpriteBatch.Begin(camera.Trasform)
    • Calls LevelManager's Draw
    • Calls EffectManager's Draw
    • Calls SpriteBatch.End()
    • Calls SpriteBatch.Begin()
    • Calls HUD's Draw
    • Calls spriteBatch.End()
  • Simulate
  • TargetEnemy
    • based on input, this will pass in the current position of the player, and the direction that the right thumbstick was pressed, into the SelectEnemy method in LevelManager. The method will return the enemy that should be targeted based on that, and if null then the targeted enemy should not get changed.
  • UpdatePossession
    • This method will be called by an input delegate when a possession is in progress. If it is a hard possession it will immediately calculate, based on the targeted enemies willpower, if it will be successful. If it is, it will pass that enemy to the player. If it is a soft possession this method will take care of sending the info that the HUD needs so it can draw the possession meter correctly. It will also calculate if a soft possession in progress should fail/succeed.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License