public void start() { if (myState != true) { return; } if (!kibbled) { Kibbler(kibble); kibbled = true; } activeZone.SendMessage("setKillAllZombies"); foreach (Transform child in kibble.transform) { foreach (Transform childChild in child.transform) { GameObject clone; clone = Instantiate(childChild.gameObject, childChild.transform.position, childChild.transform.rotation) as GameObject; Destroy(clone, 4); Rigidbody body = clone.AddComponent <Rigidbody>(); DestroyAfterX desx = clone.AddComponent <DestroyAfterX>(); } } GameObject gun = Instantiate(reward, transform.position, transform.rotation) as GameObject; foreach (GameObject spawner in mySpawners) { spawner.SetActive(true); } activator.SetActive(false); foreach (GameObject wall in walls) { wall.SetActive(true); } }
void Start() { _DestroyAfterX = this.GetComponent <DestroyAfterX> (); }