Пример #1
0
    private void RaycastUI()
    {
        RaycastHit hit;
        Ray        ray = new Ray(m_StartPoint.position, m_StartPoint.forward);

        UpdateCursorPosition(Vector3.zero);
        if (Physics.Raycast(ray, out hit, m_MaxDist, m_LayerMask))
        {
            // Hit canvas
            m_hitPoint = hit.point;
            UpdateCursorPosition(m_hitPoint + hit.normal * 0.01f);
            if (hit.collider.CompareTag("VRButton"))
            {
                // hover it hover the button
                if (!m_currentButton)
                {
                    m_currentButton = hit.collider.GetComponent <VRRayButton>();
                    m_currentButton.ToggleHoverButton(true);
                }
            }
            else
            {
                // un-hover the button
                if (m_currentButton)
                {
                    m_currentButton.ToggleHoverButton(false);
                    m_currentButton = null;
                }
            }
        }
        else
        {
            // un-hover the button
            if (m_currentButton)
            {
                m_currentButton.ToggleHoverButton(false);
                m_currentButton = null;
            }
        }
    }
 public void DisableButton(ref VRRayButton button)
 {
     button.ToggleEnableButton(false);
 }