private void updateTooltips()
    {
        OVRInput.Controller controller = grabbable?.grabbedBy?.Controller ?? OVRInput.Controller.None;

        if (grabbable.isGrabbed && controller != OVRInput.Controller.None)
        {
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetIndexTrigger(controller));
            string tooltip    = $"{buttonName} - Squeeze Ventilator";

            grabbedBy            = controller;
            setTooltipForSqueeze = true;

            if (!HandVRTooltipController.HasTooltipText(controller))
            {
                HandVRTooltipController.ShowTooltip(controller, tooltip);
                previousTooltip = tooltip;
            }
        }

        if (setTooltipForSqueeze && controller == OVRInput.Controller.None)
        {
            if (HandVRTooltipController.GetTooltipText(grabbedBy).Equals(previousTooltip))
            {
                HandVRTooltipController.HideTooltip(grabbedBy);
            }

            setTooltipForSqueeze = false;
            grabbedBy            = OVRInput.Controller.None;
        }
    }
    void OnTriggerExit(Collider otherCollider)
    {
        ButtonInteracter interacter = otherCollider.GetComponentInParent <ButtonInteracter>();

        if (interacter != null)
        {
            OVRInput.Controller controller = interacter.Controller;

            HandVRTooltipController.HideTooltip(controller);
            controllersInCollider.Remove(controller);
        }
    }
    void OnTriggerExit(Collider otherCollider)
    {
        ButtonInteracter interacter = otherCollider.GetComponentInParent <ButtonInteracter>();

        if (interacter != null)
        {
            OVRInput.Controller controller = interacter.Controller;

            HandVRTooltipController.HideTooltip(controller);
            controllersInCPRCollider.Remove(controller);

            if (controllersInCPRCollider.Count == 0)
            {
                // TODO - Check if removing hands from area stopping CPR is intuitive or not
                if (StopCompressionWhenNoHands)
                {
                    CPR.StopCompressions();
                }
            }
        }
    }
    private void interactionDone(OVRInput.Controller controller)
    {
        HandVRTooltipController.HideTooltip(controller);

        GameObject hand          = controllerToGameObject.GetOrDefault(controller, null);
        Vector3    startPosition = interactionStartPosition.GetOrDefault(controller, Vector3.zero);
        Vector3    handPosition  = hand?.transform?.position ?? Vector3.zero;

        float startTime = interactionStartTime.GetOrDefault(controller, -1);

        if (startPosition != Vector3.zero && handPosition != Vector3.zero && startTime != -1)
        {
            float distance = Vector3.Distance(startPosition, handPosition);
            float duration = Time.time - startTime;

            Rub rub = new Rub(distance, duration, startTime, LocationName);

            babyRubController.Rubs.Enqueue(rub);
        }

        interactionStartPosition.Remove(controller);
        interactionStartTime.Remove(controller);
    }
    void updateControllerTooltip(GameObject hand, OVRGrabber grabber)
    {
        // Grabbing tooltips should have lowest priority

        OVRInput.Controller controller = grabber.Controller;
        string buttonName  = VRButtonHelper.HumanizeButton(VRButtonHelper.GetHandTrigger(controller));
        string grabTooltip = $"{buttonName} (Hold) - Grab";

        if (grabber.grabbedObject == null && grabber.grabbingCandidates.Count > 0)
        {
            if (!HandVRTooltipController.HasTooltipText(controller))
            {
                HandVRTooltipController.ShowTooltip(controller, grabTooltip);
            }
        }
        else
        {
            if (HandVRTooltipController.GetTooltipText(controller).Equals(grabTooltip))
            {
                HandVRTooltipController.HideTooltip(controller);
            }
        }
    }
    // Keep controllers that are relevant to the jawgrip
    // This includes controllers that initally held the button within the collider if not using toggle mode
    private void updateRelevantControllers()
    {
        HashSet <OVRInput.Controller> newRelevantControllers = new HashSet <OVRInput.Controller>();

        foreach (OVRInput.Controller controller in relevantInputControllers)
        {
            if (!ForceHandInCollider && gripButtonHeld(controller))
            {
                newRelevantControllers.Add(controller);
            }
            else
            {
                HandVRTooltipController.HideTooltip(controller);
            }
        }

        foreach (OVRInput.Controller controller in controllersInCollider)
        {
            newRelevantControllers.Add(controller);
        }

        relevantInputControllers.Clear();
        relevantInputControllers.UnionWith(newRelevantControllers);
    }
Esempio n. 7
0
 public void hideInteractionTooltip(OVRInput.Controller controller)
 {
     HandVRTooltipController.HideTooltip(controller);
 }
 private void HideTooltip()
 {
     HandVRTooltipController.HideTooltip(ControllerInCollider);
 }