public void HandleCoinScore(CoinColor type, int coinPoints) { noCoinScored = false; if (type == activePlayer.GetPlayerType() || playerHandlers.Length == 1) { activePlayer.AddScore(coinPoints); } bool whiteCoinsAllScored = true; bool blackCoinsAllScored = true; print(FindObjectsOfType <CoinHandler>().Length); foreach (CoinHandler coin in FindObjectsOfType <CoinHandler>()) { if (coin.GetCoinColor() == CoinColor.White) { whiteCoinsAllScored = false; } if (coin.GetCoinColor() == CoinColor.Black) { blackCoinsAllScored = false; } } print(whiteCoinsAllScored + "\t" + blackCoinsAllScored); if (playerHandlers.Length == 1) { if (whiteCoinsAllScored && blackCoinsAllScored) { print(activePlayer); GameOver(activePlayer); } } else if (whiteCoinsAllScored || blackCoinsAllScored) { if ((whiteCoinsAllScored && activePlayer.GetPlayerType() == CoinColor.White) || (blackCoinsAllScored && activePlayer.GetPlayerType() == CoinColor.Black)) { GameOver(activePlayer); } else { SwitchPlayer(Array.IndexOf(playerHandlers, activePlayer) + 1); GameOver(activePlayer); } } }