Esempio n. 1
0
        /// <summary>
        /// Sets the current CameraRaycaster
        /// </summary>
        /// <param name="clear">Detaches events and clears field</param>
        void SetCameraRaycaster(bool clear = false)
        {
            if (m_CameraRaycaster != null)
                m_CameraRaycaster.OnCanRaycastChange -= OnCanRaycastChange;

            m_CameraRaycaster = clear ? null : m_Canvas.worldCamera.GetComponent<CameraRaycaster>();

            if (m_CameraRaycaster != null)
                m_CameraRaycaster.OnCanRaycastChange += OnCanRaycastChange;
        }
Esempio n. 2
0
        void SetCurrentCamera(CameraRaycaster crc)
        {
            if (m_CurrentCamera == crc)
                return;

            if (m_CurrentCamera != null)
                m_CurrentCamera.CanRaycast = false;

            m_CurrentCamera = crc;

            if (m_CurrentCamera == null)
                m_MainCamera.CanRaycast = true;
        }
Esempio n. 3
0
        void Start()
        {
            // Set Main Camera
            //SetMainCamera();
            m_MainCamera = MainCamera;// != null ? MainCamera : Camera.main.GetComponent<CameraRaycaster>();

            // Set Overlay Cameras
            //var overlayCameras = OverlayCameras != null ? OverlayCameras : GetComponentsInChildren<CameraRaycaster>().Where(c => c.tag == "Overlay Camera");
            foreach (var oc in OverlayCameras)
            {
                oc.SetCameraDepth(20 + OverlayCameras.Count() - m_OverlayCameras.Count);
                oc.CanRaycast = false;

                m_OverlayCameras.Add(oc);
            }
        }