private void Clear() { int Height = 1; int Width = 1; BoxScript ts = null; GameObject go = null; for (int x = 0; x < Width; x++) { for (int z = 0; z < Height; z++) { go = this.gameObject.transform.Find("Tile_" + x.ToString() + "_" + z.ToString()).gameObject; ts = go.GetComponent <BoxScript>(); bool cOn = (((x % 2) == 0) && ((z % 2) == 0)); ts.ColorChange(false); } } }
private void Initialize() { // Create Tiles for (int x = 0; x < Width; x++) { for (int z = 0; z < Height; z++) { Vector3 v = new Vector3(x * Scale, 0, z * Scale); Quaternion q = new Quaternion(0, 0, 0, 0); GameObject go = GameObject.Instantiate(TileMaster, v, q); go.transform.parent = this.gameObject.transform; go.name = "Tile_" + x.ToString() + "_" + z.ToString(); BoxScript ts = go.GetComponent <BoxScript>(); bool cOn = (((x % 2) == 0) && ((z % 2) == 0)); ts.ColorChange(cOn); } } // Set Camera GameObject camera = GameObject.FindGameObjectWithTag("MainCamera"); camera.transform.position = new Vector3(MaxWidth / 2, MaxHeight / 2 * 5, MaxHeight / 2); }