Пример #1
0
        override public bool RaycastAgainstMeshCollider(Ray rRay, out RaycastHit rHitInfo, float fDist)
        {
            rHitInfo = new RaycastHit();

            // If we're dragging a gizmo, we're always colliding with this panel.
            if (m_LightGizmo_Shadow.IsBeingDragged)
            {
                rHitInfo.point  = m_LightGizmo_Shadow.transform.position;
                rHitInfo.normal = (rHitInfo.point - rRay.origin).normalized;
                return(true);
            }
            else if (m_LightGizmo_NoShadow.IsBeingDragged)
            {
                rHitInfo.point  = m_LightGizmo_NoShadow.transform.position;
                rHitInfo.normal = (rHitInfo.point - rRay.origin).normalized;
                return(true);
            }

            // Precise checks against gizmos.
            if (!m_ActivePopUp && m_GazeActive)
            {
                if (m_LightGizmo_Shadow.Collider.Raycast(rRay, out rHitInfo, fDist))
                {
                    rHitInfo.point   = m_LightGizmo_Shadow.transform.position;
                    rHitInfo.normal  = (rHitInfo.point - rRay.origin).normalized;
                    m_GizmoPointedAt = m_LightGizmo_Shadow;
                    return(true);
                }
                else if (m_LightGizmo_NoShadow.Collider.Raycast(rRay, out rHitInfo, fDist))
                {
                    rHitInfo.point   = m_LightGizmo_NoShadow.transform.position;
                    rHitInfo.normal  = (rHitInfo.point - rRay.origin).normalized;
                    m_GizmoPointedAt = m_LightGizmo_NoShadow;
                    return(true);
                }
                else
                {
                    m_GizmoPointedAt = null;
                }

                // Gross checks against broad colliders for gizmos.  These checks ensure the user doesn't
                // lose focus on the panel when targeting a light gizmo that's angled in a way where pointing
                // at it would not satisfy the standard checks below.
                if (m_LightGizmo_Shadow.BroadCollider.Raycast(rRay, out rHitInfo, fDist) ||
                    m_LightGizmo_NoShadow.BroadCollider.Raycast(rRay, out rHitInfo, fDist))
                {
                    // Spoof a collision along the plane of the mesh collider
                    Plane meshPlane = new Plane(m_MeshCollider.transform.forward,
                                                m_MeshCollider.transform.position);
                    float rayDist;
                    meshPlane.Raycast(rRay, out rayDist);
                    rHitInfo.point  = rRay.GetPoint(rayDist);
                    rHitInfo.normal = m_MeshCollider.transform.forward;
                    return(true);
                }
            }

            // Fall back on standard panel collider.
            return(base.RaycastAgainstMeshCollider(rRay, out rHitInfo, fDist));
        }
Пример #2
0
        override protected void OnEnablePanel()
        {
            base.OnEnablePanel();
            if (m_LightGizmo_Shadow)
            {
                m_LightGizmo_Shadow.gameObject.SetActive(true);
            }
            else
            {
                m_LightGizmo_Shadow = Instantiate(m_MainLightGizmoPrefab);
                m_LightGizmo_Shadow.SetParentPanel(this);
            }
            m_LightGizmo_Shadow.UpdateTint();

            if (m_LightGizmo_NoShadow)
            {
                m_LightGizmo_NoShadow.gameObject.SetActive(true);
            }
            else
            {
                m_LightGizmo_NoShadow = Instantiate(m_SecondaryLightGizmoPrefab);
                m_LightGizmo_NoShadow.SetParentPanel(this);
            }
            m_LightGizmo_NoShadow.UpdateTint();

            m_ShadowLightFake.gameObject.SetActive(true);
            m_NoShadowLightFake.gameObject.SetActive(true);
            ActivateButtons(true);
        }
Пример #3
0
 override public void PanelGazeActive(bool bActive)
 {
     base.PanelGazeActive(bActive);
     m_LightGizmo_Shadow.UpdateDragState(false, false);
     m_LightGizmo_NoShadow.UpdateDragState(false, false);
     for (int i = 0; i < m_LightButtons.Length; ++i)
     {
         m_LightButtons[i].ResetState();
     }
     m_GizmoPointedAt = null;
     if (!bActive)
     {
         TutorialManager.m_Instance.ClearLightGizmoHint();
     }
 }