/// <summary> /// Draws the game during the attack phase. /// </summary>s public static void DrawDiscovery() { const int SCORES_LEFT = 172; const int SHOTS_TOP = 157; const int HITS_TOP = 206; const int SPLASH_TOP = 256; if ((SwinGame.KeyDown(KeyCode.vk_LSHIFT) | SwinGame.KeyDown(KeyCode.vk_RSHIFT)) & SwinGame.KeyDown(KeyCode.vk_c)) { UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, true); } else { UtilityFunctions.DrawField(GameController.HumanPlayer.EnemyGrid, GameController.ComputerPlayer, false); } //UtilityFunctions.DrawDestroyedShips(GameController.HumanPlayer); UtilityFunctions.DrawDestroyedShips(GameController.ComputerPlayer); UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer); UtilityFunctions.DrawMessage(); SwinGame.DrawText(GameController.HumanPlayer.Shots.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SHOTS_TOP); SwinGame.DrawText(GameController.HumanPlayer.Hits.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, HITS_TOP); SwinGame.DrawText(GameController.HumanPlayer.Missed.ToString(), Color.White, GameResources.GameFont("Menu"), SCORES_LEFT, SPLASH_TOP); UtilityFunctions.DrawAxis(); }
/// <summary> /// Draw the end of the game screen, shows the win/lose state /// </summary> public static void DrawEndOfGame() { var toDraw = default(Rectangle); string whatShouldIPrint; UtilityFunctions.DrawField(GameController.ComputerPlayer.PlayerGrid, GameController.ComputerPlayer, true); UtilityFunctions.DrawSmallField(GameController.HumanPlayer.PlayerGrid, GameController.HumanPlayer); toDraw.X = 0; toDraw.Y = 250; toDraw.Width = SwinGame.ScreenWidth(); toDraw.Height = SwinGame.ScreenHeight(); if (GameController.HumanPlayer.IsDestroyed) { whatShouldIPrint = "YOU LOSE!"; } else { whatShouldIPrint = "-- WINNER --"; } SwinGame.DrawTextLines(whatShouldIPrint, Color.White, Color.Transparent, GameResources.GameFont("ArialLarge"), FontAlignment.AlignCenter, toDraw); }