private void OnTriggerEnter(Collider other) { ObjectsInBeam.Add(other.gameObject); SetLaserPointerCol(laserPointerItemsCol); NotifyOnDisable disableNotifier = other.gameObject.GetComponent <NotifyOnDisable>(); if (disableNotifier != null) { disableNotifier.OnObjectDisabled += OnObjectInBeamDisabled; } }
private void OnTriggerExit(Collider other) { ObjectsInBeam.Remove(other.gameObject); if (ObjectsInBeam.Count == 0) { SetLaserPointerCol(laserPointerNoItemsCol); } NotifyOnDisable disableNotifier = other.gameObject.GetComponent <NotifyOnDisable>(); if (disableNotifier != null) { disableNotifier.OnObjectDisabled -= OnObjectInBeamDisabled; } }