/// <summary> /// Passes the current 'playing' player to the next in line, ie. at the end of a move. /// Also, calls startTurn on the new player. /// </summary> public void nextPlayerTurn() { //TODO: Debugging //board.wipe(); //End Debugging int nextTurnIndex = (players.IndexOf(currentTurnPlayer) + 1) % players.Count; currentTurnPlayer = players[nextTurnIndex]; //TODO: Debugging //if(nextTurnIndex == 0) board.wipe(); //End Debugging List<BoardMove> validMoves = gameRules.getValidMoves(board, currentTurnPlayer); if(validMoves.Count <= 0) { gameRules.setUpBoard(board, players); validMoves = gameRules.getValidMoves(board, currentTurnPlayer); } if(validMoves.Count > 0) { currentTurnPlayer.beginTurn(validMoves); } }