Ejemplo n.º 1
0
    private void UpdateEvents()
    {
        // Left grip
        if (m_inputDowns["left_grip"] == 1f)
        {
            current.LeftGripDown(OVRInput.Controller.LTouch);
            current.GripDown(m_leftHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["left_grip"] == -1f)
        {
            current.LeftGripUp(OVRInput.Controller.LTouch);
            current.GripUp(m_leftHand, OVRInput.Controller.None);
        }
        // Right Grip
        if (m_inputDowns["right_grip"] == 1f)
        {
            current.RightGripDown(OVRInput.Controller.RTouch);
            current.GripDown(m_rightHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["right_grip"] == -1f)
        {
            current.RightGripUp(OVRInput.Controller.RTouch);
            current.GripUp(m_rightHand, OVRInput.Controller.None);
        }

        // Left Index Trigger
        if (m_inputDowns["left_index"] == 1f)
        {
            current.LeftTriggerDown(OVRInput.Controller.LTouch);
            current.TriggerDown(m_leftHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["left_index"] == -1f)
        {
            current.LeftTriggerUp(OVRInput.Controller.LTouch);
            current.TriggerUp(m_leftHand, OVRInput.Controller.None);
        }
        // Right Index Trigger
        if (m_inputDowns["right_index"] == 1f)
        {
            current.RightTriggerDown(OVRInput.Controller.RTouch);
            current.TriggerDown(m_rightHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["right_index"] == -1f)
        {
            current.RightTriggerUp(OVRInput.Controller.RTouch);
            current.TriggerUp(m_rightHand, OVRInput.Controller.None);
        }

        // Left One Button
        if (m_inputDowns["left_one"] == 1f)
        {
            current.LeftOneDown(OVRInput.Controller.LTouch);
            current.OneDown(m_leftHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["left_one"] == -1f)
        {
            current.LeftOneUp(OVRInput.Controller.None);
            current.OneUp(m_leftHand, OVRInput.Controller.None);
        }
        // Right One Button
        if (m_inputDowns["right_one"] == 1f)
        {
            current.RightOneDown(OVRInput.Controller.RTouch);
            current.OneDown(m_rightHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["right_one"] == -1f)
        {
            current.RightOneUp(OVRInput.Controller.RTouch);
            current.OneUp(m_rightHand, OVRInput.Controller.None);
        }

        // Left Two Button
        if (m_inputDowns["left_two"] == 1f)
        {
            current.LeftTwoDown(OVRInput.Controller.LTouch);
            current.TwoDown(m_leftHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["left_two"] == -1f)
        {
            current.LeftTwoUp(OVRInput.Controller.None);
            current.TwoUp(m_leftHand, OVRInput.Controller.None);
        }
        // Right Two Button
        if (m_inputDowns["right_two"] == 1f)
        {
            current.RightTwoDown(OVRInput.Controller.RTouch);
            current.TwoDown(m_rightHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["right_two"] == -1f)
        {
            current.RightTwoUp(OVRInput.Controller.RTouch);
            current.TwoUp(m_rightHand, OVRInput.Controller.None);
        }

        // Left Thumbstick Press Button
        if (m_inputDowns["left_thumbPress"] == 1f)
        {
            current.LeftThumbPress(OVRInput.Controller.LTouch);
            current.ThumbPress(m_leftHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["left_thumbPress"] == -1f)
        {
            current.LeftThumbRelease(OVRInput.Controller.None);
            current.ThumbRelease(m_leftHand, OVRInput.Controller.None);
        }
        // Right Thumbstick Press Button
        if (m_inputDowns["right_thumbPress"] == 1f)
        {
            current.RightThumbPress(OVRInput.Controller.RTouch);
            current.ThumbPress(m_rightHand, OVRInput.Controller.None);
        }
        if (m_inputDowns["right_thumbPress"] == -1f)
        {
            current.RightThumbRelease(OVRInput.Controller.RTouch);
            current.ThumbRelease(m_rightHand, OVRInput.Controller.None);
        }

        // Left Start Button
        if (m_inputDowns["start"] == 1f)
        {
            current.StartDown();
        }
        if (m_inputDowns["start"] == -1f)
        {
            current.StartUp();
        }

        if (m_thumbDirections["left"] != Vector2.zero)
        {
            current.LeftThumbDirection(OVRInput.Controller.LTouch, m_thumbDirections["left"], m_thumbAngles["left"]);
        }
        if (m_thumbDirections["right"] != Vector2.zero)
        {
            current.RightThumbDirection(OVRInput.Controller.RTouch, m_thumbDirections["right"], m_thumbAngles["right"]);
        }

        // Grabbed Objects
        if (m_grabbedObjectsChanged["left"])
        {
            current.LeftHandGrabbedChanged(OVRInput.Controller.LTouch, m_grabbedObjects["left"]);
            current.GrabbedChanged(m_leftHand, OVRInput.Controller.LTouch, m_grabbedObjects["left"]);
        }
        if (m_grabbedObjectsChanged["right"])
        {
            current.RightHandGrabbedChanged(OVRInput.Controller.RTouch, m_grabbedObjects["right"]);
            current.GrabbedChanged(m_rightHand, OVRInput.Controller.LTouch, m_grabbedObjects["right"]);
        }

        // Pointer Targets
        if (m_pointerTargetsChanged["left"])
        {
            current.LeftPointerTargetChanged(OVRInput.Controller.LTouch, m_pointerTargets["left"]);
        }
        if (m_pointerTargetsChanged["right"])
        {
            current.RightPointerTargetchanged(OVRInput.Controller.RTouch, m_pointerTargets["right"]);
        }
    }