Ejemplo n.º 1
0
 public void Deactivate()
 {
     module?.SetRenderLayer(false);
     cameraInstance.gameObject.SetActive(false);
     module   = null;
     priority = CameraNotInUse;
 }
Ejemplo n.º 2
0
 public void Deactivate()
 {
     module?.SetRenderLayer(false);
     cameraInstance?.gameObject?.SetActive(false);
     cameraInstance?.transform?.SetParent(parent.transform, false);
     module   = null;
     priority = CameraNotInUse;
 }
Ejemplo n.º 3
0
        public void Refresh()
        {
            Deactivate();

            while (module == null)
            {
                module = parent.NextInStack;
                if (module == null)
                {
                    /*
                     * if (!TakeFromBackupCamera())
                     * {
                     *      break;
                     * }*/
                    break;
                }
                if (ModuleIsSolved)
                {
                    module = null;
                    continue;
                }

                if (module.index > 0)
                {
                    index = module.index;
                }
                else
                {
                    index        = ++ModuleCameras.index;
                    module.index = index;
                }
                priority = module.priority;

                int layer = (parent.LastInteractiveState ? cameraLayer : nonInteractiveCameraLayer);

                cameraInstance.cullingMask       = (1 << layer) | (1 << 31);
                module.nonInteractiveCameraLayer = layer;
                Debug.LogFormat("[ModuleCameras] Switching component's layer from {0} to {1}", module.component.gameObject.layer, layer);
                module.SetRenderLayer(true);
                Transform t = module.component.transform.Find("TwitchPlayModuleCamera");
                if (t == null)
                {
                    t      = new GameObject().transform;
                    t.name = "TwitchPlayModuleCamera";
                    t.SetParent(module.component.transform, false);
                }
                cameraInstance.transform.SetParent(t, false);
                cameraInstance.gameObject.SetActive(true);

                Debug.LogFormat("[ModuleCameras] Component's layer is {0}. Camera's bitmask is {1}", module.component.gameObject.layer, cameraInstance.cullingMask);

                Vector3 lossyScale = cameraInstance.transform.lossyScale;
                cameraInstance.nearClipPlane = 1.0f * lossyScale.y;
                cameraInstance.farClipPlane  = 3.0f * lossyScale.y;
                Debug.LogFormat("[ModuleCameras] Camera's lossyScale is {0}; Setting near plane to {1}, far plane to {2}", lossyScale, cameraInstance.nearClipPlane, cameraInstance.farClipPlane);
            }
        }
Ejemplo n.º 4
0
        public void Refresh()
        {
            Deactivate();

            while (module == null)
            {
                module = parent.NextInStack;
                if (module == null)
                {
                    /*
                     * if (!TakeFromBackupCamera())
                     * {
                     *  break;
                     * }*/
                    break;
                }
                if (ModuleIsSolved)
                {
                    module = null;
                    continue;
                }

                if (module.index > 0)
                {
                    index = module.index;
                }
                else
                {
                    index        = ++ModuleCameras.index;
                    module.index = index;
                }
                priority = module.priority;

                // We know the camera's culling mask is pointing at a single layer, so let's find out what that layer is
                cameraInstance.cullingMask = 1 << cameraLayer;
                Debug.LogFormat("[ModuleCameras] Switching component's layer from {0} to {1}", module.component.gameObject.layer, cameraLayer);
                module.SetRenderLayer(true);
                cameraInstance.transform.SetParent(module.component.transform, false);
                cameraInstance.gameObject.SetActive(true);

                Debug.LogFormat("[ModuleCameras] Component's layer is {0}. Camera's bitmask is {1}", module.component.gameObject.layer, cameraInstance.cullingMask);

                Vector3 lossyScale = cameraInstance.transform.lossyScale;
                cameraInstance.nearClipPlane = 1.0f * lossyScale.y;
                cameraInstance.farClipPlane  = 3.0f * lossyScale.y;
                Debug.LogFormat("[ModuleCameras] Camera's lossyScale is {0}; Setting near plane to {1}, far plane to {2}", lossyScale, cameraInstance.nearClipPlane, cameraInstance.farClipPlane);
            }
        }