Exemple #1
0
    public static void DetermineWinnerOfRound(PieceType type)
    {
        if (LevelManager._isPlayer1Red)
        {
            if (_isPlayerTurn == PieceType.RED)
            {
                _Player1Points++;
            }
            else
            {
                _Player2Points++;
            }
        }
        else
        {
            if (_isPlayerTurn == PieceType.RED)
            {
                _Player2Points++;
            }
            else
            {
                _Player1Points++;
            }
        }
        CurrentScore.UpdateScoreText(GetCurrentPlayerName());

        int winningScore = (int)(((float)LevelManager.GetNumberOfRounds() / 2) + 1);

        if (winningScore <= _Player1Points || winningScore <= _Player2Points)//Game is won
        {
            UltimateWinner.UpdateUltimateWinnerText(GetCurrentPlayerName());
            Results.UpdateResultsText();
            SaveMatch();
            WinScreen.TriggerWinScreen();
            _IsGameOver = true;
        }
        else//round won
        {
            RoundScreen.TriggerRoundWinScreen();
            RoundWinner.UpdateRoundWinnerText(GetCurrentPlayerName());
            _IsGameOver = true;
        }
    }