private static void ApplyPostFX(CinemachineBrain brain)
        {
            PostProcessLayer component = brain.GetComponent <PostProcessLayer>();

            if (component == null || !component.enabled || component.volumeLayer == 0)
            {
                return;
            }
            CameraState currentCameraState  = brain.CurrentCameraState;
            int         numCustomBlendables = currentCameraState.NumCustomBlendables;
            List <PostProcessVolume> dynamicBrainVolumes = CinemachinePostProcessing.GetDynamicBrainVolumes(brain, component, numCustomBlendables);

            for (int i = 0; i < dynamicBrainVolumes.Count; i++)
            {
                dynamicBrainVolumes[i].weight        = 0f;
                dynamicBrainVolumes[i].sharedProfile = null;
                dynamicBrainVolumes[i].profile       = null;
            }
            for (int j = 0; j < numCustomBlendables; j++)
            {
                CameraState.CustomBlendable customBlendable           = currentCameraState.GetCustomBlendable(j);
                CinemachinePostProcessing   cinemachinePostProcessing = customBlendable.m_Custom as CinemachinePostProcessing;
                if (!(cinemachinePostProcessing == null))
                {
                    PostProcessVolume postProcessVolume = dynamicBrainVolumes[j];
                    postProcessVolume.sharedProfile = cinemachinePostProcessing.Profile;
                    postProcessVolume.isGlobal      = true;
                    postProcessVolume.priority      = float.MaxValue;
                    postProcessVolume.weight        = customBlendable.m_Weight;
                }
            }
        }
Exemplo n.º 2
0
        private static void ApplyPostFX(CinemachineBrain brain)
        {
            PostProcessLayer ppLayer = CinemachinePostProcessing.GetPPLayer(brain);

            if (Object.op_Equality((Object)ppLayer, (Object)null) || !((Behaviour)ppLayer).get_enabled() || LayerMask.op_Implicit((LayerMask)ppLayer.volumeLayer) == 0)
            {
                return;
            }
            CameraState currentCameraState = brain.get_CurrentCameraState();
            int         customBlendables   = ((CameraState) ref currentCameraState).get_NumCustomBlendables();
            List <PostProcessVolume> dynamicBrainVolumes = CinemachinePostProcessing.GetDynamicBrainVolumes(brain, ppLayer, customBlendables);

            for (int index = 0; index < dynamicBrainVolumes.Count; ++index)
            {
                dynamicBrainVolumes[index].weight        = (__Null)0.0;
                dynamicBrainVolumes[index].sharedProfile = null;
                dynamicBrainVolumes[index].set_profile((PostProcessProfile)null);
            }
            PostProcessVolume postProcessVolume1 = (PostProcessVolume)null;
            int num = 0;

            for (int index = 0; index < customBlendables; ++index)
            {
                CameraState.CustomBlendable customBlendable = ((CameraState) ref currentCameraState).GetCustomBlendable(index);
                CinemachinePostProcessing   custom          = customBlendable.m_Custom as CinemachinePostProcessing;
                if (!Object.op_Equality((Object)custom, (Object)null))
                {
                    PostProcessVolume postProcessVolume2 = dynamicBrainVolumes[index];
                    if (Object.op_Equality((Object)postProcessVolume1, (Object)null))
                    {
                        postProcessVolume1 = postProcessVolume2;
                    }
                    postProcessVolume2.sharedProfile = (__Null)custom.Profile;
                    postProcessVolume2.isGlobal      = (__Null)1;
                    postProcessVolume2.priority      = (__Null)(3.40282346638529E+38 - (double)(customBlendables - index) - 1.0);
                    postProcessVolume2.weight        = customBlendable.m_Weight;
                    ++num;
                }
                if (num > 1)
                {
                    postProcessVolume1.weight = (__Null)1.0;
                }
            }
        }