void resetCube() { for (int i = 0; i < 96; i++) { string name = "Cube" + i.ToString(); GameObject child = GameObject.Find(name); colorTest color = child.GetComponent <colorTest>(); color.changeColor(0); color.state = 0; } }
void highlightCube() { int x, z, tx, tz; x = pos % 12; z = pos / 12; for (int i = 0; i < 96; i++) { tx = i % 12; tz = i / 12; if (Mathf.Abs(tx - x) + Mathf.Abs(tz - z) <= speed) { string name = "Cube" + i.ToString(); GameObject child = GameObject.Find(name); colorTest color = child.GetComponent <colorTest>(); color.changeColor(1); color.state = 1; } } }