//Does exactly as the method is named, draws the objects on the screen public virtual void Draw(SpriteBatch sB, GraphicsDeviceManager gM) { foreach (CameraManager.Camera c in cameras.GetCameras()) { managers.SetCurrentCam(c); gM.GraphicsDevice.Viewport = c.port; Vector2 displacement = cameras.GetDisplacement(c.commanderType); sB.Begin(); backgrounds.DrawBackgrounds(sB, displacement); paths.Draw(sB, displacement); objects.DrawBottom(sB, displacement); particles.DrawBottom(sB, displacement); typeOfGame.DrawBottom(sB, displacement); abilities.DrawBottom(sB, displacement); projectiles.Draw(sB, displacement); agents.DrawLowest(sB, displacement); abilities.DrawTop(sB, displacement); particles.DrawTop(sB, displacement); objects.DrawTop(sB, displacement); typeOfGame.DrawTop(sB, displacement); agents.DrawHighest(sB, displacement); backgrounds.Drawforegrounds(sB, displacement); typeOfGame.DrawHUD(sB); cameras.GetHud(c).Draw(sB, managers); sB.End(); } }
//Where the objects will be updated (this means any actions that they can do can actually be done) public virtual Level Update(GameTime gT) { managers.Update(gT, Keyboard.GetState()); cameras.UpdateStateBefore(); if (cameras.GetPauser() == null) { //End game if the game is ended if (typeOfGame.Update(managers)) { return(new ResultsScreen(this, textures, sounds)); } agents.Update(); projectiles.Update(); objects.Update(); paths.Update(); spawns.Update(); particles.Update(); abilities.Update(); sounds.Update(); backgrounds.Update(); statistics.Update(managers); } else { if (cameras.GetCameras()[cameras.GetPauserIndex()].GetState().IsButtonDown(Buttons.Back)) { return(new Menu(textures, sounds)); } } cameras.Update(managers); cameras.UpdateStateAfter(); return(this); }