Пример #1
0
        private void UpdateScore_Tick(object sender, EventArgs e)
        {
            // Update scoreboard text
            Scoreboard.Text = $"{player1.Score} | {player2.Score}";

            // Check for player one victory
            if (player1.Score >= ScoreToWin)
            {
                BallMovement.Stop();
                btnRestart.Visible   = true;
                labelVictory.Visible = true;
                labelVictory.Text    = "Player 1 has won!";
            }

            if (player2.Score >= ScoreToWin)
            {
                BallMovement.Stop();
                btnRestart.Visible   = true;
                labelVictory.Visible = true;
                labelVictory.Text    = "Player 2 has won!";
            }
        }