Exemplo n.º 1
0
        //Draw Heads up Display. Draws all labels, scores, intermission information, etc.
        private void DrawHUD()
        {
            if (gamePhase == 3)
            {
                Label gameover = new Label();
                gameover.Margin     = new Thickness(230, 200, 0, 0);
                gameover.Content    = "THE END";
                gameover.FontSize   = 30;
                gameover.FontFamily = new FontFamily("Segoe WP Black");
                gameover.Foreground = getColor(0);
                //Brushes.Red;
                gameover.FontWeight = FontWeights.Bold;
                gameCanvas.Children.Add(gameover);

                Label gameOverScore = new Label();
                gameOverScore.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                gameOverScore.Margin     = new Thickness(230, 250, 0, 0);
                gameOverScore.Content    = "SCORE        " + score;
                gameOverScore.FontSize   = 20;
                gameOverScore.FontFamily = new FontFamily("Segoe WP Black");
                gameOverScore.Foreground = getColor(0);
                //Brushes.Red;
                gameOverScore.FontWeight = FontWeights.Bold;
                gameCanvas.Children.Add(gameOverScore);

                return;
            }

            if (gamePhase == 4)
            {
                Label scoreLabel       = new Label();
                Label scoreHeaderLabel = new Label();
                scoreHeaderLabel.Margin  = new Thickness(190, 50, 0, 0);
                scoreLabel.Margin        = new Thickness(200, 60, 0, 0);
                scoreHeaderLabel.Content = "HIGH SCORES";
                scoreLabel.Content       = "";
                int l = 0;
                foreach (ScoreEntry SC in scores)
                {
                    if (l < 15)
                    {
                        scoreLabel.Content += Environment.NewLine + SC.Get();
                        l++;
                    }
                }
                scoreHeaderLabel.FontSize   = 20;
                scoreLabel.FontSize         = 15;
                scoreLabel.FontFamily       = new FontFamily("Segoe WP Black");
                scoreHeaderLabel.FontFamily = new FontFamily("Segoe WP Black");
                scoreLabel.Foreground       = getColor(0);
                scoreHeaderLabel.Foreground = getColor(1);

                scoreLabel.FontWeight       = FontWeights.Bold;
                scoreHeaderLabel.FontWeight = FontWeights.Bold;


                gameCanvas.Children.Add(scoreLabel);
                gameCanvas.Children.Add(scoreHeaderLabel);
            }

            //round counter
            if (gamePhase == 0 || gamePhase == 1 || missiles.Count() > 0)
            {
                Label round = new Label();
                round.Margin = new Thickness(30, 430, 0, 0);
                if (difficulty != 3)
                {
                    round.Content = "ROUND " + roundCount;
                }
                else
                {
                    round.Content = "ROUND ∞";
                }
                round.FontSize   = 20;
                round.FontFamily = new FontFamily("Segoe WP Black");
                round.Foreground = getColor(1);
                //Brushes.Black;
                round.FontWeight = FontWeights.Bold;
                gameCanvas.Children.Add(round);
            }

            if (gamePhase == 2 && missiles.Count() == 0)
            {
                Label bonusLabel = new Label();
                bonusLabel.Margin     = new Thickness(200, 100, 0, 0);
                bonusLabel.Content    = "BONUS POINTS";
                bonusLabel.FontSize   = 20;
                bonusLabel.FontFamily = new FontFamily("Segoe WP Black");
                bonusLabel.Foreground = getColor(1);
                //Brushes.Blue;
                bonusLabel.FontWeight = FontWeights.Bold;
                gameCanvas.Children.Add(bonusLabel);


                Label missilePointsLabel = new Label();
                missilePointsLabel.Margin     = new Thickness(210, 150, 0, 0);
                missilePointsLabel.Content    = "" + (flakPoints * 5);
                missilePointsLabel.FontSize   = 20;
                missilePointsLabel.FontFamily = new FontFamily("Segoe WP Black");
                missilePointsLabel.Foreground = getColor(0);

                missilePointsLabel.FontWeight = FontWeights.Bold;

                gameCanvas.Children.Add(missilePointsLabel);

                for (int k = 0; k < flakPoints; k++)
                {
                    DrawAmmo((270 + (k * 10)), 165);
                }


                Label cityPointsLabel = new Label();
                cityPointsLabel.Margin     = new Thickness(210, 200, 0, 0);
                cityPointsLabel.Content    = "" + (cityPoints * 100);
                cityPointsLabel.FontSize   = 20;
                cityPointsLabel.FontFamily = new FontFamily("Segoe WP Black");
                cityPointsLabel.Foreground = getColor(0);

                cityPointsLabel.FontWeight = FontWeights.Bold;

                gameCanvas.Children.Add(cityPointsLabel);

                Label multiplierLabel = new Label();
                multiplierLabel.Margin     = new Thickness(210, 250, 0, 0);
                multiplierLabel.Content    = (roundType + 1) + "   ✖   POINTS";
                multiplierLabel.FontSize   = 20;
                multiplierLabel.FontFamily = new FontFamily("Segoe WP Black");
                multiplierLabel.Foreground = getColor(0);

                multiplierLabel.FontWeight = FontWeights.Bold;

                gameCanvas.Children.Add(multiplierLabel);

                int mCtr = 0;
                foreach (City miniC in cityArray)
                {
                    if (!miniC.IsDestroyed())
                    {
                        DrawCity((280 + (mCtr * 30)), 220, 2, false);
                        mCtr++;
                    }
                }
            }

            Label myScoreLabel = new Label();

            myScoreLabel.Margin     = new Thickness(375, 430, 0, 0);
            myScoreLabel.Content    = "SCORE " + score;
            myScoreLabel.FontSize   = 20;
            myScoreLabel.FontFamily = new FontFamily("Segoe WP Black");
            myScoreLabel.Foreground = getColor(1);

            myScoreLabel.FontWeight = FontWeights.Bold;

            gameCanvas.Children.Add(myScoreLabel);
        }