public override void Initialize()
        {
            MediaPlayer.Stop();

            _menuIndex = 0;

            _title = (Died) ? "YOU DIED !" : "TIME'S UP !";

            // Scores
            _content.Clear();
            _content.Add("Time: " + Math.Round(Time.TotalSeconds, 2).ToString(CultureInfo.InvariantCulture) + " second(s)");
            _content.Add("Wave number: " + WaveNumber.ToString(CultureInfo.InvariantCulture));
            _content.Add("P1 Score: " + Player1Score.ToString(CultureInfo.InvariantCulture));
            if (Config.PlayersNumber == 2)
            {
                _content.Add("P2 Score: " + Player2Score.ToString(CultureInfo.InvariantCulture));
            }

            _content.Add("Total Score: " + TotalScore.ToString(CultureInfo.InvariantCulture));

            _content.Add("Total credits: " + PlayerData.Credits.ToString(CultureInfo.InvariantCulture));

            _actions = new string[] { "Try again", "Back to title screen" };

            base.Initialize();
        }
Ejemplo n.º 2
0
 public override void Render(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (Player == 1)
     {
         spriteBatch.DrawString(font, Player1Score.ToString(), new Vector2(Position.Value.X, Position.Value.Y), Colour);
     }
     else
     {
         spriteBatch.DrawString(font, Player2Score.ToString(), new Vector2(Position.Value.X, Position.Value.Y), Colour);
     }
 }
Ejemplo n.º 3
0
    private void Update()
    {
        player1ScoreText.text = Player1Score.ToString();
        player2ScoreText.text = Player2Score.ToString();
        int tempTime = (int)Timer;

        timer.text = tempTime.ToString();

        if (Timer > 0)
        {
            m_timer -= Time.deltaTime;
        }
    }
Ejemplo n.º 4
0
        private void CheckInteraction()
        {
            if (player1.X + Settings.RectWidth >= gamefield.Width)
            {
                player1.X = gamefield.Width - Settings.RectWidth;
            }
            if (player1.X <= 0)
            {
                player1.X = 0;
            }
            if (player2.X + Settings.RectWidth >= gamefield.Width)
            {
                player2.X = gamefield.Width - Settings.RectWidth;
            }
            if (player2.X <= 0)
            {
                player2.X = 0;
            }

            if (ball.X + Settings.CircleWidth > gamefield.Width || ball.X <= 0)
            {
                Settings.ballvelX *= -1;
            }
            if (ball.Y > gamefield.Height)
            {
                Player2Score++;
                p2score.Text = Player2Score.ToString();
                StartGame();
            }
            if (ball.Y <= 0)
            {
                Player1Score++;
                p1score.Text = Player1Score.ToString();
                StartGame();
            }
            if (ball.X + Settings.CircleWidth > player1.X && ball.X < player1.X + Settings.RectWidth && ball.Y + Settings.CircleHeight > player1.Y)
            {
                Settings.ballvelY *= -1;
            }
            if (ball.X + Settings.CircleWidth > player2.X && ball.X < player2.X + Settings.RectWidth && ball.Y < player2.Y + Settings.RectHeight)
            {
                Settings.ballvelY *= -1;
            }
        }
Ejemplo n.º 5
0
        private void Update()
        {
            string  json    = File.ReadAllText(OutputFile);
            dynamic jsonObj = JsonConvert.DeserializeObject(json);

            jsonObj["header1"]          = Header1;
            jsonObj["header2"]          = Header2;
            jsonObj["player1GamerTag"]  = Player1Name;
            jsonObj["player2GamerTag"]  = Player2Name;
            jsonObj["player1Score"]     = Player1Score.ToString();         // if not tostring, no quotes will be around number and both numbers will update :-/
            jsonObj["player2Score"]     = Player2Score.ToString();
            jsonObj["player1Port"]      = Player1Port.ToString();
            jsonObj["player2Port"]      = Player2Port.ToString();
            jsonObj["player1Character"] = Player1Character;
            jsonObj["player2Character"] = Player2Character;
            string output = JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);

            if (Header1.Contains("Finals") || Header1.Contains("Loser's Semis"))
            {
                GameCountLimit = 5;
            }

            File.WriteAllText(OutputFile, output);
        }
Ejemplo n.º 6
0
    private void AddScoreToPlayer1()
    {
        ++Player1Score;

        player1ScoreText.text = Player1Score.ToString();
    }