private IEnumerator StartTurn() { coroutineAllowed = false; //this player doesn't have a Dead Flag if (!players[turn].IsDead()) { for (int i = 0; i <= 20; i++) { roll = Random.Range(1, 7); yield return(new WaitForSeconds(0.05f)); } Chip chip = players[turn].GetChip(); //Chip moving, and must done moving before do checking. chip.Moving(roll); yield return(new WaitUntil(() => chip.IsMoving() == false)); //Start Checking isChecking = true; if (isChecking) { Color color = players[turn].GetColor(); int current = players[turn].GetChip().GetCurrentPosition(); Node node = board.NodeList()[current].GetComponent <Node>(); if (node.IsMainNode()) { if (node.MaterialName().Contains(NameofColor(color))) { chip.AddHP(3); mainPanel.POPHP(turn, "+3"); } else { chip.AddHP(1); mainPanel.POPHP(turn, "+1"); } audioList.addHPSound.Play(); } else { if (node.IsEmpty()) { node.SetColor(color); } else { if (node.IsPlayerColor(color)) { if (node.IsFull()) { chip.AddHP(1); mainPanel.POPHP(turn, "+1"); audioList.addHPSound.Play(); } else { node.SetColor(color); } } else { int index = 0; for (int i = 0; i < node.ListColors().Count; i++) { if (!node.ListColors()[i].Equals(Color.grey)) { if (!node.ListColors()[i].Equals(color)) { chip.RemoveHP(1); index = i; audioList.removeHPSound.Play(); } } } mainPanel.POPHP(turn, "-" + (index + 1).ToString()); node.RemoveToken(index); if (node.IsEmpty()) { node.SetColor(color); } } } } if (chip.IsDead()) { players[turn].SetDeadFlag(true); mainPanel.DeadPanel(turn); chip.ClearToken(color, board); chip.Destory(); audioList.DeadSound.Play(); } isChecking = false; } } yield return(new WaitUntil(() => isChecking == false)); mainPanel.ShowTurn(turn, false); Check(turn); //Sending to not-Dead Player coroutineAllowed = true; //If next turn is a Bot, StartTurn() right away. if (players[turn].IsBot()) { StartCoroutine(StartTurn()); } }