Exemplo n.º 1
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;
                }
            }
        }