public bool LookForWinner() { if (WinningPlayer != null) { return(true); } var isHorizontal = CurrentPlayer().PlayerNumber != 1; if (CheckForWinningPath(CurrentPlayer().PlayerNumber)) { WinningPlayer = CurrentPlayer(); Quip("The winner is player #" + WinningPlayer.PlayerNumber + ", " + WinningPlayer.PlayerType() + "!"); var args = new GameOverArgs { WinningPlayerNumber = WinningPlayer.PlayerNumber, WinningPath = Board.LastPathChecked }; OnGameEnd(args); return(true); } SwitchPlayers(); return(false); }
private void GameEndsOnFoul() { WinningPlayer = OpponentPlayer(); var args = new GameOverArgs { WinningPlayerNumber = WinningPlayer.PlayerNumber, WinningPath = null }; OnGameEnd(args); }
protected virtual void OnGameEnd(GameOverArgs e) { Player1.GameOver(WinningPlayer.PlayerNumber); Player2.GameOver(WinningPlayer.PlayerNumber); GameOver?.Invoke(this, e); }