public void destroyAll() { for (int i = 0; i < cubepool.transform.childCount; i++) { basicCube cube = cubepool.transform.GetChild(i).GetComponent <basicCube> (); if (cube.indexY < 7) { cube.destroy(); } } // for (int i = 0; i < 7; i++) // for (int j = 0; j < 10; j++) // if (map [i] [j]) // map [i] [j].GetComponent<basicCube>().destroy (); }
public void destroyColor(string color) { // for (int i = 0; i < 7; i++) // for (int j = 0; j < 10; j++) // if (map [i] [j]&&map[i][j].tag == color) // map [i] [j].GetComponent<basicCube>().destroy (); for (int i = 0; i < cubepool.transform.childCount; i++) { basicCube cube = cubepool.transform.GetChild(i).GetComponent <basicCube> (); if (cube.indexY < 7 && cube.gameObject.tag == color) { cube.destroy(); } } }
void Start() { basic = GetComponent <basicCube> (); }