private void OnTriggerStay(Collider other) { if (isAlight) { RaycastHit hit; Physics.Raycast(transform.position, other.transform.position - transform.position, out hit); if (hit.collider != other) { return; } if (other.GetComponentInParent <Renderer>()) { if (fireManager.GetIfFlammable(other.GetComponentInParent <Renderer>().sharedMaterial)) { if (!other.GetComponentInChildren <FireSystem>()) { fireManager.AddFireSystem(other.gameObject); } else if (!other.GetComponent <MeshCollider>()) { BurnOther(other.GetComponentInChildren <FireSystem>()); } } } } }
private void OnCollisionEnter(Collision collision) { if (!collision.collider.GetComponentInChildren <FireSystem>()) { fireManager.AddFireSystem(collision.collider.gameObject); } Collider[] hitColliders = Physics.OverlapSphere(transform.position, ignitionRadius); foreach (Collider hit in hitColliders) { if (hit.GetComponent <FireSystem>()) { hit.GetComponent <FireSystem>().Ignite(); } } }
protected virtual void OnTriggerStay(Collider other) { if (isAlight) { if (fireManager.GetIfFlammable(other.GetComponentInParent <Renderer>().sharedMaterial)) { if (!other.GetComponentInChildren <FireWithTemperatureAndFuel>()) { fireManager.AddFireSystem(other.gameObject); } else if (!other.GetComponent <MeshCollider>()) { SpreadTemperature(other.GetComponentInChildren <FireWithTemperatureAndFuel>()); } } } }