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();
        }
Пример #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);
     }
 }
Пример #3
0
    void Start()
    {
        theBall = GameObject.FindGameObjectWithTag("Ball");

        Player1Score      = 0;
        Player2Score      = 0;
        P1Text.text       = Player1Score.ToString();
        P2Text.text       = Player2Score.ToString();
        messageText1.text = "";
        messageText2.text = "";
        DebugText.text    = "";
    }
Пример #4
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;
        }
    }
Пример #5
0
    void FixedUpdate()
    {
        P1Text.text = Player1Score.ToString();
        P2Text.text = Player2Score.ToString();

        if (Player1Score == BallControl.winScore)
        {
            messageText1.text = " Player 1 Victory! " + "(" + P1Text.text + " - " + P2Text.text + ")";
            theBall.SendMessage("RestartGame", 2.0f, SendMessageOptions.RequireReceiver);
        }

        if (Player2Score == BallControl.winScore)
        {
            messageText2.text = " Player 2 Victory! " + "(" + P2Text.text + " - " + P1Text.text + ")";
            theBall.SendMessage("RestartGame", 2.0f, SendMessageOptions.RequireReceiver);
        }
    }
Пример #6
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);
        }
Пример #7
0
    private void AddScoreToPlayer2()
    {
        ++Player2Score;

        player2ScoreText.text = Player2Score.ToString();
    }
Пример #8
0
 // Update is called once per frame
 public void Update()
 {
     player1 = Player1Score.ToString();
     player2 = Player2Score.ToString();
 }