/// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { // This game has a blue background. Why? Because! ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.CornflowerBlue, 0, 0); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(); kinectRGBVideo.Draw(spriteBatch); spriteBatch.Draw(UI_FrameLayer, UI_FrameLayerPosition, Color.White); //Printing out question, score string instruction = gameLevelManager.getCurrentLevelInstruction(); Vector2 fontOrigin_instruction = UI_Font_Score.MeasureString(instruction) / 2; spriteBatch.DrawString(UI_Font_Score, instruction, UI_FontPosition_Instruction, Color.Black, 0, fontOrigin_instruction, 1.5f, SpriteEffects.None, 0.5f); string score = "Score: " + GameScoringSystem.Instance.getScore(); Vector2 fontOrigin_score = UI_Font_Score.MeasureString(score) / 2; spriteBatch.DrawString(UI_Font_Score, score, UI_FontPosition_Score, Color.Black, 0, fontOrigin_score, 1.5f, SpriteEffects.None, 0.5f); string level = "Level: " + gameLevelManager.getCurrentLevel().ToString(); Vector2 fontOrigin_level = UI_Font_Score.MeasureString(level) / 2; spriteBatch.DrawString(UI_Font_Level, level, UI_FontPosition_Level, Color.Black, 0, fontOrigin_level, 1.5f, SpriteEffects.None, 0.5f); string time = "Time: " + gameTimeManager.getRoundTime(); Vector2 fontOrigin_time = UI_Font_Score.MeasureString(time) / 2; spriteBatch.DrawString(UI_Font_Time, time, UI_FontPosition_Time, Color.Black, 0, fontOrigin_time, 1.5f, SpriteEffects.None, 0.5f); if (debuggerOn) //Debugger { skeletonDebugger.DrawSkeletonOverlay_XNA(spriteBatch, new LineBrush(ScreenManager.GraphicsDevice, 3), UI_KinectFrameOffset, new Vector2(kinectRuntime.VideoStream.Width, kinectRuntime.VideoStream.Height), Color.Red); } spriteBatch.End(); if (IsActive) { particleRenderer.RenderEffect(particleEffect); // Draw text. Text tween position are being updated in Update() textAnim_GoodJob.DrawText("Good Job!~", Color.Azure, spriteBatch, new Vector2(ScreenManager.Game.Window.ClientBounds.Width / 2, ScreenManager.Game.Window.ClientBounds.Height / 3), new Vector2(ScreenManager.Game.Window.ClientBounds.Width / 2, ScreenManager.Game.Window.ClientBounds.Height - 80), 2.0f, 3.0f); textAnim_GameOver.DrawText("GAME OVER! Score: " + GameScoringSystem.Instance.getScore(), Color.DarkGreen, spriteBatch, new Vector2(ScreenManager.Game.Window.ClientBounds.Width / 2, ScreenManager.Game.Window.ClientBounds.Height / 3), new Vector2(ScreenManager.Game.Window.ClientBounds.Width / 2, ScreenManager.Game.Window.ClientBounds.Height - 300), 3.0f, 3.0f); foreach (GameObject g in currentGameSet) { g.Draw(spriteBatch); } solutionObjectReplica.Draw(spriteBatch); } // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } }