Esempio n. 1
0
        /// <summary>
        /// Draw the end of the game screen, shows the win/lose state
        /// </summary>
        public static void DrawEndOfGame()
        {
            Rectangle toDraw = new Rectangle();
            string    whatShouldIPrint;

            UtilityFunctions.DrawField(GameController.Instance.ComputerPlayer.PlayerGrid, GameController.Instance.ComputerPlayer, true);
            UtilityFunctions.DrawSmallField(GameController.Instance.HumanPlayer.PlayerGrid, GameController.Instance.HumanPlayer);

            toDraw.X      = 0;
            toDraw.Y      = 250;
            toDraw.Width  = SwinGame.ScreenWidth();
            toDraw.Height = SwinGame.ScreenHeight();

            if (GameController.Instance.HumanPlayer.IsDestroyed)
            {
                whatShouldIPrint = "YOU LOSE!";
            }
            else
            {
                whatShouldIPrint = "-- WINNER --";
            }

            SwinGame.DrawText(whatShouldIPrint, Color.White, Color.Transparent, GameResources.Instance.GameFont("ArialLarge"), FontAlignment.AlignCenter, toDraw); // orignialy draw text lines
        }
        /// <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.LeftShiftKey) | SwinGame.KeyDown(KeyCode.RightShiftKey)) & SwinGame.KeyDown(KeyCode.CKey))
            {
                UtilityFunctions.DrawField(GameController.Instance.HumanPlayer.EnemyGrid, GameController.Instance.ComputerPlayer, true);
            }
            else
            {
                UtilityFunctions.DrawField(GameController.Instance.HumanPlayer.EnemyGrid, GameController.Instance.ComputerPlayer, false);
            }

            UtilityFunctions.DrawSmallField(GameController.Instance.HumanPlayer.PlayerGrid, GameController.Instance.HumanPlayer);
            UtilityFunctions.DrawDestoyedField(GameController.Instance.ComputerPlayer.PlayerGrid, GameController.Instance.ComputerPlayer);
            UtilityFunctions.Instance.DrawMessage();

            SwinGame.DrawText(GameController.Instance.HumanPlayer.Shots.ToString(), Color.White, GameResources.Instance.GameFont("Menu"), SCORES_LEFT, SHOTS_TOP);
            SwinGame.DrawText(GameController.Instance.HumanPlayer.Hits.ToString(), Color.White, GameResources.Instance.GameFont("Menu"), SCORES_LEFT, HITS_TOP);
            SwinGame.DrawText(GameController.Instance.HumanPlayer.Missed.ToString(), Color.White, GameResources.Instance.GameFont("Menu"), SCORES_LEFT, SPLASH_TOP);
        }