private void OnTriggerEnter(Collider other) { // lighting chick if (other.tag == "ChickCollider" && other.transform.GetChild(1).gameObject.activeInHierarchy) { isLighting = true; ChickColliderController otherCCC = other.transform.GetComponent <ChickColliderController>(); chicksBurning.Add(otherCCC.chickController); //lighterCount += 1; } // gets put out if (other.tag == "Water") { onFire = false; timeLeft = timeToDestruction; lightingTimeLeft = lightingTime; } }
private void OnTriggerExit(Collider other) { if (other.tag == "ChickCollider" && other.transform.GetChild(1).gameObject.activeInHierarchy) { ChickColliderController otherCCC = other.transform.GetComponent <ChickColliderController>(); ChickController chickController = chicksBurning.Find(cc => cc == otherCCC.chickController); if (chickController != null) { chicksBurning.Remove(chickController); if (chicksBurning.Count == 0) { isLighting = false; lightingTimeLeft = lightingTime; } } } }