Example #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);
            }
        }
    }