private void OnTriggerExit2D(Collider2D collision) { IInfectable infectableObject = collision.GetComponent <IInfectable>(); if (infectableObject != null) { allInfectablesInRange.Remove(infectableObject); } }
private void OnTriggerEnter(Collider other) { GameObject collisioned = other.gameObject; if (collisioned.GetComponent <IInfectable>() != null) { inRange = true; iInfectable = collisioned.GetComponent <IInfectable>(); } }