// This is called when the game should draw itself. protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.BlendState = BlendState.Opaque; GraphicsDevice.DepthStencilState = DepthStencilState.Default; // Basically says if the menu state = Menu the draw everything associated with the menu which was previously mentioned. if (gamestate == GameStates.Menu) { spriteBatch.Begin(); menu.DrawMenu(spriteBatch, graphics.GraphicsDevice.Viewport.Width, fontToUse); spriteBatch.End(); } // draw code for game if gamestate is in play state else if (gamestate == GameStates.Play) { // creates transformation matrix for the playermodel. Matrix[] transforms = new Matrix[player.playerModel.Bones.Count]; //calls the draw method which is within the player class. player.Draw(camera, aspectRatio, transforms); //draws dalek list for (int i = 0; i < GameConstants.NumDaleks; i++) { if (dalekList[i].isActive) { Matrix dalekTransform = Matrix.CreateScale(GameConstants.DalekScalar) * Matrix.CreateTranslation(dalekList[i].position); DrawModel(mdlDalek, dalekTransform, mdDalekTransforms); } } //Draws laser list for (int i = 0; i < GameConstants.NumLasers; i++) { if (laserList[i].isActive) { Matrix laserTransform = Matrix.CreateScale(GameConstants.LaserScalar) * Matrix.CreateTranslation(laserList[i].position); DrawModel(mdlLaser, laserTransform, mdlLaserTransforms); } } //calls the drawlandscape method DrawLandscape(); graphics.GraphicsDevice.RasterizerState = RasterizerState.CullClockwise; // Draw skybox which passes in the camera skybox.Draw(camera); graphics.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; // to get landscape viewable GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap; GraphicsDevice.BlendState = BlendState.Opaque; GraphicsDevice.DepthStencilState = DepthStencilState.Default; } // Drawing code for Control screen else if (gamestate == GameStates.Controls) { spriteBatch.Begin(); Rectangle screenRectangle = new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height); spriteBatch.Draw(backGround, screenRectangle, Color.White); spriteBatch.End(); } base.Draw(gameTime); }