private void ShowAttachTooltip()
    {
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(ControllerInCollider));
        string tooltip    = $"{buttonName} - Attach Ventilator";

        HandVRTooltipController.ShowTooltip(ControllerInCollider, tooltip);
    }
    // Check if the user is performing the inputs for a compression
    // This means using one/both controllers, and then letting go off all buttons to reset
    // Queues up a CPR compression if inputs change
    private void checkUserInput()
    {
        int  activeControllers = 0;
        bool newState          = false;

        foreach (OVRInput.Controller controller in controllersInCPRCollider)
        {
            if (controller != OVRInput.Controller.None)
            {
                activeControllers += OVRInput.Get(VRButtonHelper.GetTopFaceButton(controller)) ? 1 : 0;
            }
        }

        if (previousState)
        {
            newState = activeControllers > 0;
        }
        else
        {
            newState = activeControllers >= MinimumControllersPerCompression;
        }

        CPR.UpdateCompressionState(newState && !previousState);

        previousState = newState;
        previousControllersPressing = activeControllers;
    }
    //Checks if the user is using KBM or VR controllers, updates lerp, and StartedVentilating
    private void updateLerpAcordingToInput()
    {
        previousLerp = lerp;

        if (VRKBMInputState.UsingVR)
        {
            OVRGrabbable        grabbable  = GetComponent <OVRGrabbable>();
            OVRInput.Controller controller = grabbable?.grabbedBy?.Controller ?? OVRInput.Controller.None;
            if (grabbable.isGrabbed)
            {
                lerp = 1 - OVRInput.Get(VRButtonHelper.GetIndexTriggerAnalogue(controller));
                StartedVentilating = true;
            }
            else
            {
                // The user is no longer holding the object, reset to unsqueezed
                lerp = 1;
            }
        }
        else if (VRKBMInputState.UsingKBM)
        {
            if (Input.GetKey(KeyCode.P) || simulatedPress)
            {
                lerp = Mathf.Clamp(lerp - m_keyboardLerpStep * Time.deltaTime, 0.0f, 1.0f);
                StartedVentilating = true;
            }
            else
            {
                lerp = Mathf.Clamp(lerp + m_keyboardLerpStep * Time.deltaTime, 0.0f, 1.0f);
            }
        }
    }
    private void setTooltips()
    {
        foreach (OVRInput.Controller controller in relevantInputControllers)
        {
            string tooltip    = "";
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));

            if (gripButtonHeld(controller))
            {
                if (!AllowTogglingJawGrip)
                {
                    tooltip = $"{buttonName} (Hold) - Holding Jaw Grip";
                }
            }
            else
            {
                if (!AllowTogglingJawGrip)
                {
                    tooltip = $"{buttonName} (Hold) - Hold Jaw Grip";
                }
                else
                {
                    string info = HoldingGrip ? "Release Jaw Grip" : "Start Jaw Grip";

                    tooltip = $"{buttonName} - {info}";
                }
            }

            if (!String.IsNullOrEmpty(tooltip))
            {
                HandVRTooltipController.ShowTooltip(controller, tooltip);
            }
        }
    }
    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;
        }
    }
    private void showInteractionTooltip(OVRInput.Controller controller)
    {
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetHandTrigger(controller));
        string newStatus  = active ? "Reset Stopwatch" : "Stop Stopwatch";
        string tooltip    = $"{buttonName} - {newStatus}";

        HandVRTooltipController.ShowTooltip(controller, tooltip);
    }
Beispiel #7
0
    private void showInteractionTooltip(OVRInput.Controller controller)
    {
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));
        string newStatus  = LightState ? "Turn Off Heatlamp" : "Turn On Heatlamp";
        string tooltip    = $"{buttonName} - {newStatus}";

        HandVRTooltipController.ShowTooltip(controller, tooltip);
    }
    private void setTooltips()
    {
        foreach (OVRInput.Controller controller in controllersInCPRCollider)
        {
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));
            string tooltip    = $"{buttonName} - Compress";

            HandVRTooltipController.ShowTooltip(controller, tooltip);
        }
    }
    private bool gripButtonHeld(OVRInput.Controller controller)
    {
        if (controller != OVRInput.Controller.None)
        {
            if (OVRInput.Get(VRButtonHelper.GetTopFaceButton(controller)))
            {
                return(true);
            }
        }

        return(false);
    }
    private void checkForVentilatorDetach()
    {
        if (!maskStatusChanged && Attached)
        {
            if (OVRInput.GetDown(VRButtonHelper.GetTopFaceButton(ControllerInCollider)) || OVRInput.GetDown(VRButtonHelper.GetTopFaceButton(controllerThatAttached)))
            {
                DetachMask();
                HideTooltip();

                controllerThatAttached = OVRInput.Controller.None;

                maskStatusChanged = true;
            }
        }
    }
    private void checkForVentilatorAttach()
    {
        if (!maskStatusChanged && !Attached && ControllerInCollider != OVRInput.Controller.None)
        {
            if (OVRInput.GetDown(VRButtonHelper.GetTopFaceButton(ControllerInCollider)))
            {
                controllerThatAttached = ControllerInCollider;

                AttachMask();
                HideTooltip();

                maskStatusChanged = true;
            }
        }
    }
Beispiel #12
0
    private void showInteractionTooltip(OVRInput.Controller controller)
    {
        string tooltip;
        string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetHandTrigger(controller));

        if (rotating)
        {
            tooltip = $"{buttonName} (Hold) - Turn Knob";
        }
        else
        {
            tooltip = $"{buttonName} (Hold) - Grab Knob";
        }

        HandVRTooltipController.ShowTooltip(controller, tooltip);
    }
    // Check if activation button is active
    private bool checkInput(BaseButton button)
    {
        switch (button.m_button)
        {
        case ButtonChoice.HandTrigger:
            return(OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, m_controller) > interactionThreshold);

        case ButtonChoice.IndexTrigger:
            return(OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, m_controller) > interactionThreshold);

        case ButtonChoice.ActionButton:
            return(OVRInput.Get(VRButtonHelper.GetTopFaceButton(m_controller)));

        default:
            return(false);
        }
    }
    private void CheckForVentilatorAttach()
    {
        if (!IsOximeterAttached && controllerInCollider != OVRInput.Controller.None)
        {
            if (OVRInput.Get(VRButtonHelper.GetTopFaceButton(controllerInCollider)))
            {
                OVRGrabbable grabber = PulseOximeter.GetComponentInChildren <OVRGrabbable>();

                grabber.ReleaseObject();
                grabber.enabled = false;

                attachOxymeterToFoot(targetBone);
                DisablePhysicsCollider(PulseOximeter);
                IsOximeterAttached = true;

                HideTooltip();
            }
        }
    }
    private void setTooltips()
    {
        foreach (OVRInput.Controller controller in controllersInCollider)
        {
            string tooltip;
            string buttonName = VRButtonHelper.HumanizeButton(VRButtonHelper.GetTopFaceButton(controller));

            if (checkTopFaceButton(controller))
            {
                tooltip = $"{buttonName} (Hold) - Move Controller to Stimulate";
            }
            else
            {
                tooltip = $"{buttonName} (Hold) - Stimulate Baby";
            }


            HandVRTooltipController.ShowTooltip(controller, tooltip);
        }
    }
    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);
            }
        }
    }
 private bool checkTopFaceButton(OVRInput.Controller controller)
 {
     return(OVRInput.Get(VRButtonHelper.GetTopFaceButton(controller)));
 }