private void OnTriggerEnter(Collider other) { if (collecting) { TinyChicken chickScript = other.GetComponentInParent <TinyChicken>(); if (chickScript != null) { chickScript.active = false; chickScript.gameObject.SetActive(false); chicksCollected++; } } }
private void SpawnChickens() { for (int i = 0; i < Health; i++) { GameObject chick = ObjectPool.GetObj(LittleChicken); if (chick) { chick.transform.position = spawnPoints[Random.Range(0, spawnPoints.Length)].position; chick.transform.forward = connected.transform.forward; TinyChicken chickScript = chick.GetComponent <TinyChicken>(); chickScript.core = this; chickScript.active = true; chick.SetActive(true); } else { Health = i; } } LiveChicks = true; }