private IEnumerator tileDown() { while (true) { yield return(new WaitForSeconds(0.02f)); //int Num3 = 0; tilelist2.Clear(); for (int i = 0; i < tilelist.Count; i++) { tilelist2.Add(tilelist[i]); } if (pr_int_index % 2 == 1) { tilelist2.RemoveAt(5); } while (tilelist2.Count != 0) { //int Num2 = Random.Range(0, maplist[pr_int_index].Length-Num3); int Num2 = Random.Range(0, tilelist2.Count); int nm = tilelist2[Num2]; //Num3++; Rigidbody tileRb = maplist[pr_int_index][nm].AddComponent <Rigidbody>(); Vector3 tilerota = new Vector3(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)); tileRb.angularVelocity = tilerota * Random.Range(2f, 10f); tilelist2.RemoveAt(Num2); GameObject.Destroy(maplist[pr_int_index][nm], 1.5f); yield return(new WaitForSeconds(0.02f)); } if (pr_int_index == pr_PC_pos.Z) { StopTileDown(); pr_PC_pos.life = false; if (pr_PC_pos != null) { pr_PC_pos.gameObject.AddComponent <Rigidbody>(); pr_PC_pos.StartCoroutine("GameOver"); } } pr_int_index++; } /*for(int i=0;i<maplist[pr_int_index].Length;i++) * { * Rigidbody tileRb= maplist[pr_int_index][i].AddComponent<Rigidbody>(); * Vector3 tilerota = new Vector3(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)); * tileRb.angularVelocity = tilerota * Random.Range(2f, 10f); * yield return new WaitForSeconds(0.1f); * }(Teacher method)*/ }