public IEnumerator gamer1player() { int whoplaysfirst = 0; int rounds = 1; int i = 0; setup.round.text = "Round: " + rounds.ToString(); setup.player1house.text = "(" + phouse [0].ToString() + ")"; setup.player2house.text = "(" + phouse [1].ToString() + ")"; while ((phouse[0] != 0 && phouse[1] != 0) && rounds <= 6) { while (hand.waiting == true) { yield return(new WaitForSeconds(0.3f)); } yield return(StartCoroutine(WhoPlaysFirst1Player(whoplaysfirst))); if (plays.CheckGame(0, ref SeedsWon) != 2) { if (plays.CheckGame(0, ref SeedsWon) == 10) { SeedsWon[0] += 4; SeedsWon[1] += 4; } int houseplayer1 = SeedsWon[0] / 4; i = 0; Cstones = GameObject.FindGameObjectsWithTag("stone" + (13)); while (i < Cstones.Length) //clear the hole { Destroy(Cstones[i].gameObject); i += 1; } i = 0; Cstones = GameObject.FindGameObjectsWithTag("stone" + (14)); while (i < Cstones.Length) //clear the hole { Destroy(Cstones[i].gameObject); i += 1; } Holes[] ClHoles = FindObjectsOfType(typeof(Holes)) as Holes[]; foreach (Holes ClHole in ClHoles) { Destroy(ClHole.gameObject); } yield return(StartCoroutine(reset(houseplayer1, 12 - houseplayer1))); rounds++; setup.player1Seed.text = "X 00"; setup.player2Seed.text = "X 00"; setup.round.text = "Round: " + rounds.ToString(); setup.player1house.text = "(" + phouse [0].ToString() + ")"; setup.player2house.text = "(" + phouse [1].ToString() + ")"; turns = (whoplaysfirst + 1) % 2 + 1; whoplaysfirst = (whoplaysfirst + 1) % 2; } } if ((SeedsWon[0] / 4) > 6) { setup.EndGame("YOU WON!", GameSceneManager.choice); PlayerPrefs.SetInt("SW", PlayerPrefs.GetInt("SW", 0) + 1); } else if ((SeedsWon[0] / 4) < 6) { setup.EndGame("YOU LOSE!", GameSceneManager.choice); PlayerPrefs.SetInt("SL", PlayerPrefs.GetInt("SL", 0) + 1); } else { setup.EndGame("DRAW!", GameSceneManager.choice); PlayerPrefs.SetInt("SD", PlayerPrefs.GetInt("SD", 0) + 1); } Debug.Log("finish"); }