/// <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) { GraphicsDevice.Clear(Color.CornflowerBlue); if (intro.isShowing()) { spriteBatch.Begin(); intro.Show(spriteBatch); // show intro screen until timer runs out spriteBatch.End(); } else if (instruct.isShowing()) { spriteBatch.Begin(); instruct.Show(spriteBatch); // show instructions screen until timer runs out spriteBatch.End(); } else if (instruct2.isShowing()) { spriteBatch.Begin(); instruct2.Show(spriteBatch); // show instructions screen until timer runs out spriteBatch.End(); } else if (timex.isShowing()) { spriteBatch.Begin(); timex.Show(spriteBatch); // show time expired screen until user makes a selection spriteBatch.End(); } else if (gameover.isShowing()) { spriteBatch.Begin(); gameover.Show(spriteBatch); spriteBatch.End(); } else // no menus displayed { spriteBatch.Begin(); game_engine.Draw(gameTime, spriteBatch); spriteBatch.End(); // go to game environment } base.Draw(gameTime); } // end draw function
/// <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) { GraphicsDevice.Clear(Color.CornflowerBlue); if (intro.isShowing()) { spriteBatch.Begin(); intro.Show(spriteBatch); // show intro screen until timer runs out spriteBatch.End(); } else if (instruct.isShowing()) { spriteBatch.Begin(); instruct.Show(spriteBatch); // show instructions screen until user taps spriteBatch.End(); } else if (instruct2.isShowing()) { spriteBatch.Begin(); instruct2.Show(spriteBatch); // show instructions screen until user taps spriteBatch.End(); } else if (timex.isShowing()) { spriteBatch.Begin(); timex.Show(spriteBatch); // show time expired screen until user makes a selection / time runs out spriteBatch.End(); } else if (gameover.isShowing()) // show game over screen for 5 seconds. game will exit back to the windows phone platform after this { spriteBatch.Begin(); gameover.Show(spriteBatch); spriteBatch.End(); } else // no menus displayed { spriteBatch.Begin(); game_engine.Draw(gameTime, spriteBatch); // draw game contents according to UI, AI, time spriteBatch.End(); } base.Draw(gameTime); } // end draw function