Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private void GameEndsOnFoul()
        {
            WinningPlayer = OpponentPlayer();
            var args = new GameOverArgs
            {
                WinningPlayerNumber = WinningPlayer.PlayerNumber,
                WinningPath         = null
            };

            OnGameEnd(args);
        }
Esempio n. 3
0
 protected virtual void OnGameEnd(GameOverArgs e)
 {
     Player1.GameOver(WinningPlayer.PlayerNumber);
     Player2.GameOver(WinningPlayer.PlayerNumber);
     GameOver?.Invoke(this, e);
 }