/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { if (GameStateManager.CurrentGameState == GameStateManager.GameState.Game) { // Since we're drawing in order from back to front, depth buffer is disabled graphics.GraphicsDevice.RenderState.DepthBufferEnable = false; graphics.GraphicsDevice.Clear(Color.Black); // Prepare scene sceneGraph.NewScene(); CurrentLevel.ResetCollisionDebugInfo(); spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Deferred, SaveStateMode.SaveState); // AddToScene the background CurrentLevel.Draw(sceneGraph, spriteBatch, Color.Black); // AddToScene the player sceneGraph.AddToScene(playerSprite.ToSceneGraphNode()); // AddToScene the enemies sceneGraph.AddToScene(CurrentLevel.NpcContainer.AddToScene()); // Write debug info sceneGraph.AddText("Player position: " + playerSprite.Position + " Player destination: " + playerSprite.Destination); sceneGraph.AddText("Tile position:" + CurrentLevel.ToTileCoordinate(playerSprite.Position)); sceneGraph.AddText("Player is dead:" + playerIsDead); sceneGraph.AddText("Player keypress: " + playerSprite.currentMovement.XDirection + " " + playerSprite.currentMovement.YDirection); sceneGraph.AddText(collisionDebugString); sceneGraph.AddText("Cam position:" + camera.Position); sceneGraph.Draw(); gameHUD.Draw(bigFont, HUDPosition); //base.Draw(gameTime); spriteBatch.End(); } else { if (GameStateManager.CurrentGameState == GameStateManager.GameState.Menu) { IsMouseVisible = true; } GraphicsDevice.Clear(Color.Black); base.Draw(gameTime); } }