Beispiel #1
0
    private void _SendWandEvents()
    {
        if (!m_Wand.SendWandEvents)
        {
            return;
        }

        VRSelection selection = m_SelectionMgr.GetSelection();

        // Enter/exit events
        if (!VRSelection.Compare(m_LastSelection, selection))
        {
            // Selection changed

            // Exit last
            if (m_LastSelection != null)
            {
                m_LastSelection.SelectedObject.SendMessage("OnMVRWandExit", m_LastSelection, SendMessageOptions.DontRequireReceiver);
            }

            // Enter new
            if (selection != null)
            {
                selection.SelectedObject.SendMessage("OnMVRWandEnter", selection, SendMessageOptions.DontRequireReceiver);
            }
        }
        else
        {
            // Hover current
            if (selection != null)
            {
                selection.SelectedObject.SendMessage("OnMVRWandHover", selection, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Beispiel #2
0
    protected void Update()
    {
        VRSelection selection = m_SelectionMgr.GetSelection();

        // Send action if selection not null
        if (selection != null && selection.SelectedObject != null)
        {
            if (SendWandEvents)
            {
                // VRAction
                if ((!RepeatVRAction && MiddleVR.VRDeviceMgr.IsWandButtonToggled(0)) ||
                    (RepeatVRAction && MiddleVR.VRDeviceMgr.IsWandButtonPressed(0)))
                {
                    selection.SelectedObject.SendMessage("VRAction", selection, SendMessageOptions.DontRequireReceiver);
                }

                // Wand button pressed/released
                if (MiddleVR.VRDeviceMgr.IsWandButtonToggled(0))
                {
                    selection.SelectedObject.SendMessage("OnMVRWandButtonPressed", selection, SendMessageOptions.DontRequireReceiver);
                }
                else if (MiddleVR.VRDeviceMgr.IsWandButtonToggled(0, false))
                {
                    selection.SelectedObject.SendMessage("OnMVRWandButtonReleased", selection, SendMessageOptions.DontRequireReceiver);
                }
            }
        }
    }
Beispiel #3
0
    public VRSelection GetSelection()
    {
        // Find Selection Mgr
        VRSelectionManager selectionManager = this.GetComponent <VRSelectionManager>();

        // Return selection
        return(selectionManager.GetSelection());
    }