public void NextGame() { whitePlayerLost = false; blackPlayerLost = false; //player1Index = Random.Range(0, playerList.Count-1); //player2Index = Random.Range(0, playerList.Count-1); // Will cause an infinite loop if there's exactly one player, that should never happen //while(player1Index == player2Index){ // player2Index = Random.Range(0, playerList.Count-1); //} player1Index = currentGame; player2Index = (currentGame + playerShift) % playerList.Count; iOManager = new AIIOManager(chessManager, playerList[player1Index], playerList[player2Index]); chessManager.SetPlayerNames(playerList[player1Index].aIDNA.aiName, playerList[player2Index].aIDNA.aiName); CreateGame(playerList[player1Index], playerList[player2Index]); chessManager.StartNewGame(2); }