public void SetUpGame(PlayerType pt1, PlayerType pt2) { if (pt1 == PlayerType.Human) { Player1 = new HumanPlayer(gameBoard, "You", Side.Cross); } else if (pt1 == PlayerType.Machine) { Player1 = new MachinePlayer(gameBoard, Side.Cross, (int)aiLevel); } if (pt2 == PlayerType.Human) { Player2 = new HumanPlayer(gameBoard, "You", Side.Zero); if (pt1 == PlayerType.Machine) { Player2.OnTurnMade += (Player1 as MachinePlayer).OnEnemyMadeTurn; } } else if (pt2 == PlayerType.Machine) { Player2 = new MachinePlayer(gameBoard, Side.Zero, (int)aiLevel); if (pt1 == PlayerType.Human) { Player1.OnTurnMade += (Player2 as MachinePlayer).OnEnemyMadeTurn; } } currentPlayer = player1; }
private void nextPlayer() { if (currentPlayer == player1) { currentPlayer = player2; } else if (currentPlayer == player2) { currentPlayer = player1; } else { //WTF!!! Debug.Assert(false, "WTF in GameControler::nextPlayer()!"); } }
public void Restart() { gameBoard.Clear(); currentPlayer = player1; player1.Reset(); player2.Reset(); }