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); } } }
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); } } } }
public VRSelection GetSelection() { // Find Selection Mgr VRSelectionManager selectionManager = this.GetComponent <VRSelectionManager>(); // Return selection return(selectionManager.GetSelection()); }