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; } }
public static void CheckWinner(Vector2Int startingPoint, PieceType type) { if (CheckHorizontal(startingPoint, type) || CheckDiagTLDR(startingPoint, type) || CheckDiagDLTR(startingPoint, type) || CheckDown(startingPoint, type)) { //Determine who actually one and if there's an ultimate winner MatchManager.DetermineWinnerOfRound(type); MatchManager._CanPlay = false; } else if (GridIsFull())//Theres no more moves left { RoundScreen.TriggerRoundWinScreen(); RoundWinner.UpdateRoundWinnerText("TIE! No one"); MatchManager._IsGameOver = true; } else { MatchManager._CanPlay = true; MatchManager.EndTurn(); } }
public void JudgingComplete(Guid roundId, Player winner, string actualSearch) { var data = new RoundWinner { round_id = roundId, winning_player = (winner != null) ? winner.name : null, actual_search = actualSearch }; var request = new ObjectPusherRequest( PUBLIC_CHANNEL, "game-judging-completed", data); server.Trigger(request); }