// Update is called once per frame void OnTriggerStay(Collider col) { // Create a ray that points forwards from the camera. if(col.gameObject.layer == LayerMask.NameToLayer("UI") && !_isHit) { // Do the raycast forweards to see if we hit an interactive item interactible = col.GetComponent<LeapInteractiveItem>(); //attempt to get the LeapInteractiveItem on the hit object if (interactible._toggle) return; if (interactible.finger) { if(interactible.finger != transform) return; } Action(col); } }
// Deselects all private static void HandleDeselect() { if (_LastInteractible == null) return; ExecuteEvents.Execute(_CurrentInteractible.gameObject, eventSystem, ExecuteEvents.deselectHandler); _LastInteractible = _CurrentInteractible; _CurrentInteractible = null; if(OnDeselect != null) { OnDeselect(); } }
//Desctivates last public static void DeactiveLastInteractible() { if (_LastInteractible == null) return; ExecuteEvents.Execute(_LastInteractible.gameObject, eventSystem, ExecuteEvents.deselectHandler); _LastInteractible = null; if (OnDeselect != null) { OnDeselect(); } }