Пример #1
0
        public IEnumerator WaitCloseStatusDialog()
        {
            yield return(new WaitForSeconds(k_WaitingDelay));

            Dispatcher.Dispatch(ClearStatusAction.From(true));
            Dispatcher.Dispatch(ClearStatusAction.From(false));
            Dispatcher.Dispatch(SetInstructionMode.From(false));
        }
Пример #2
0
        void OnManageCursor(Vector3 position)
        {
            // Create Cursor
            if (m_CurrentCursorA.gameObject.activeSelf == false || m_CurrentCursorB.gameObject.activeSelf == false)
            {
                m_AnchorSelection.UnselectCursor(m_UnselectedCursorMaterial, m_CachedCursorsMeshRenderer);
                m_AnchorSelection.OnPointerUp(position);

                return;
            }

            // Selection
            if (m_MainCamera == null || !m_MainCamera.gameObject.activeInHierarchy)
            {
                m_MainCamera = Camera.main;
                if (m_MainCamera == null)
                {
                    Debug.LogError($"[{nameof(MeasureToolUIController)}] active main camera not found!");
                    return;
                }
            }

            RaycastHit hitInfo;
            Ray        ray = m_MainCamera.ScreenPointToRay(position);

            if (m_VREnableSelector.GetValue() && m_VRControllerSelector.GetValue() != null)
            {
                ray.origin    = m_VRControllerSelector.GetValue().position;
                ray.direction = m_VRControllerSelector.GetValue().forward;
            }

            if (Physics.Raycast(ray, out hitInfo))
            {
                if (hitInfo.transform.gameObject.Equals(m_CurrentCursorA))
                {
                    Dispatcher.Dispatch(ClearStatusAction.From(true));
                    Dispatcher.Dispatch(ClearStatusAction.From(false));
                    m_AnchorSelection.UnselectCursor(m_UnselectedCursorMaterial, m_CachedCursorsMeshRenderer);
                    m_AnchorSelection.SelectCursor(m_CurrentCursorA, m_SelectedCursorMaterial, m_CachedCursorsMeshRenderer);
                    return;
                }

                if (hitInfo.transform.gameObject.Equals(m_CurrentCursorB))
                {
                    Dispatcher.Dispatch(ClearStatusAction.From(true));
                    Dispatcher.Dispatch(ClearStatusAction.From(false));
                    m_AnchorSelection.UnselectCursor(m_UnselectedCursorMaterial, m_CachedCursorsMeshRenderer);
                    m_AnchorSelection.SelectCursor(m_CurrentCursorB, m_SelectedCursorMaterial, m_CachedCursorsMeshRenderer);
                    return;
                }
            }

            // Unselect
            Dispatcher.Dispatch(ClearStatusAction.From(true));
            Dispatcher.Dispatch(ClearStatusAction.From(false));
            m_AnchorSelection.UnselectCursor(m_UnselectedCursorMaterial, m_CachedCursorsMeshRenderer);
        }