private void OnTriggerEnter(Collider other) { IActivation activationObject = other.GetComponent <IActivation>(); if (activationObject != null) { activationObject.DoActivate(); } }
private void OnCollisionEnter(Collision collision) { IBreakable breakable = collision.gameObject.GetComponent <IBreakable>(); if (breakable != null) { breakable.BreakObject(); } IActivation activationObject = collision.gameObject.GetComponent <IActivation>(); if (activationObject != null) { activationObject.DoActivate(); } }