protected virtual void ToggleHighlight(Collider collider, bool state) { VRTK_InteractableObject ioCheck = ValidSnapObject(collider.gameObject, true, state); if (highlightObject != null && ioCheck != null) { //Toggle the highlighter state SetHighlightObjectActive(state); ioCheck.SetSnapDropZoneHover(this, state); willSnap = state; if (state) { if (!IsObjectHovering(collider.gameObject) || wasSnapped) { OnObjectEnteredSnapDropZone(SetSnapDropZoneEvent(collider.gameObject)); } AddCurrentValidSnapObject(collider.gameObject); } else { OnObjectExitedSnapDropZone(SetSnapDropZoneEvent(collider.gameObject)); RemoveCurrentValidSnapObject(collider.gameObject); } } }
protected virtual void CheckCanUnsnap(VRTK_InteractableObject interactableObjectCheck) { if (interactableObjectCheck != null && currentValidSnapInteractableObjects.Contains(interactableObjectCheck) && ValidUnsnap(interactableObjectCheck)) { if (isSnapped && currentSnappedObject == interactableObjectCheck) { ForceUnsnap(); } RemoveCurrentValidSnapObject(interactableObjectCheck); if (!ValidSnappableObjectIsHovering()) { ToggleHighlight(interactableObjectCheck, false); willSnap = false; } interactableObjectCheck.SetSnapDropZoneHover(this, false); if (ValidSnapObject(interactableObjectCheck, true)) { ToggleHighlightColor(); OnObjectExitedSnapDropZone(SetSnapDropZoneEvent(interactableObjectCheck.gameObject)); } } }
protected virtual void ToggleHighlight(Collider collider, bool state) { VRTK_InteractableObject ioCheck = ValidSnapObject(collider.gameObject, true); if (highlightObject && ioCheck) { //Turn on the highlighter highlightObject.SetActive(state); ioCheck.SetSnapDropZoneHover(this, state); willSnap = state; isHighlighted = state; if (state) { OnObjectEnteredSnapDropZone(SetSnapDropZoneEvent(collider.gameObject)); currentValidSnapObject = collider.gameObject; } else { OnObjectExitedSnapDropZone(SetSnapDropZoneEvent(collider.gameObject)); currentValidSnapObject = null; } } }
protected virtual void CheckCanSnap(VRTK_InteractableObject interactableObjectCheck) { if (interactableObjectCheck != null && ValidSnapObject(interactableObjectCheck, true)) { AddCurrentValidSnapObject(interactableObjectCheck); if (!isSnapped) { ToggleHighlight(interactableObjectCheck, true); interactableObjectCheck.SetSnapDropZoneHover(this, true); if (!willSnap) { OnObjectEnteredSnapDropZone(SetSnapDropZoneEvent(interactableObjectCheck.gameObject)); } willSnap = true; ToggleHighlightColor(); } } }