Esempio n. 1
0
        private void ApplyPreset(Preset preset)
        {
            var suite = preset.isMapPreset ? gameEffects.map_effectSuite : gameEffects.effectSuite;

            // FOV Override
            if (preset.OVERRIDE_FOV)
            {
                cameraController.override_fov       = true;
                cameraController.override_fov_value = preset.OVERRIDE_FOV_VALUE;
            }

            // Light on camera
            if (preset.LIGHT_ENABLED)
            {
                lightController.LIGHT_ENABLED   = true;
                lightController.LIGHT_RANGE     = preset.LIGHT_RANGE;
                lightController.LIGHT_ANGLE     = preset.LIGHT_ANGLE;
                lightController.LIGHT_INTENSITY = preset.LIGHT_INTENSITY;
                lightController.LIGHT_COLOR     = preset.LIGHT_COLOR;
                lightController.LIGHT_POSITION  = preset.LIGHT_POSITION;
                lightController.LIGHT_COOKIE    = preset.LIGHT_COOKIE;
            }

            // Ambient Occlusion
            if (preset.AO.enabled.value)
            {
                suite.AO.enabled.Override(preset.AO.enabled.value);
                suite.AO.intensity.Override(preset.AO.intensity.value);
                suite.AO.quality.Override(preset.AO.quality.value);
                suite.AO.mode.Override(preset.AO.mode.value);
            }

            // Automatic Exposure
            if (preset.EXPO.enabled.value)
            {
                suite.EXPO.enabled.Override(preset.EXPO.enabled.value);
                suite.EXPO.keyValue.Override(preset.EXPO.keyValue.value);
            }

            // Bloom
            if (preset.BLOOM.enabled.value)
            {
                suite.BLOOM.enabled.Override(preset.BLOOM.enabled.value);
                suite.BLOOM.intensity.Override(preset.BLOOM.intensity.value);
                suite.BLOOM.threshold.Override(preset.BLOOM.threshold.value);
                suite.BLOOM.diffusion.Override(preset.BLOOM.diffusion.value);
                suite.BLOOM.fastMode.Override(preset.BLOOM.fastMode.value);
            }

            // Chromatic aberration
            if (preset.CA.enabled.value)
            {
                suite.CA.enabled.Override(preset.CA.enabled.value);
                suite.CA.intensity.Override(preset.CA.intensity.value);
                suite.CA.fastMode.Override(preset.CA.fastMode.value);
            }

            // Color Grading
            if (preset.COLOR.enabled)
            {
                suite.COLOR.gradingMode.Override(GradingMode.HighDefinitionRange);
                suite.COLOR.enabled.Override(preset.COLOR.enabled.value);
                suite.COLOR.tonemapper.Override(preset.COLOR.tonemapper.value);
                suite.COLOR.temperature.Override(preset.COLOR.temperature.value);
                suite.COLOR.tint.Override(preset.COLOR.tint.value);
                suite.COLOR.postExposure.Override(preset.COLOR.postExposure.value);
                suite.COLOR.hueShift.Override(preset.COLOR.hueShift.value);
                suite.COLOR.saturation.Override(preset.COLOR.saturation.value);
                suite.COLOR.contrast.Override(preset.COLOR.contrast.value);
                suite.COLOR.lift.Override(preset.COLOR.lift.value);
                suite.COLOR.gamma.Override(preset.COLOR.gamma.value);
                suite.COLOR.gain.Override(preset.COLOR.gain.value);
            }

            // Depth Of Field
            if (preset.DOF.enabled.value)
            {
                suite.DOF.enabled.Override(preset.DOF.enabled.value);
                gameEffects.focus_mode = preset.FOCUS_MODE;
                if (preset.FOCUS_MODE == FocusMode.Custom)  // if it is player/skate it gets set during lateupdate (instead of onGUI)
                {
                    suite.DOF.focusDistance.Override(preset.DOF.focusDistance.value);
                }
                suite.DOF.aperture.Override(preset.DOF.aperture.value);
                suite.DOF.focalLength.Override(preset.DOF.focalLength.value);
                suite.DOF.kernelSize.Override(preset.DOF.kernelSize.value);
            }

            // Grain
            if (preset.GRAIN.enabled.value)
            {
                suite.GRAIN.enabled.Override(preset.GRAIN.enabled.value);
                suite.GRAIN.colored.Override(preset.GRAIN.colored.value);
                suite.GRAIN.intensity.Override(preset.GRAIN.intensity.value);
                suite.GRAIN.size.Override(preset.GRAIN.size.value);
                suite.GRAIN.lumContrib.Override(preset.GRAIN.lumContrib.value);
            }

            // Lens Distortion
            if (preset.LENS.enabled.value)
            {
                suite.LENS.enabled.Override(preset.LENS.enabled.value);
                suite.LENS.intensity.Override(preset.LENS.intensity.value);
                suite.LENS.intensityX.Override(preset.LENS.intensityX.value);
                suite.LENS.intensityY.Override(preset.LENS.intensityY.value);
                suite.LENS.scale.Override(preset.LENS.scale.value);
            }

            // Motion Blur
            if (preset.BLUR.enabled.value)
            {
                suite.BLUR.enabled.Override(preset.BLUR.enabled.value);
                suite.BLUR.shutterAngle.Override(preset.BLUR.shutterAngle.value);
                suite.BLUR.sampleCount.Override(preset.BLUR.sampleCount.value);
            }

            // Screen Space Reflections
            if (preset.REFL.enabled.value)
            {
                suite.REFL.enabled.Override(preset.REFL.enabled.value);
                suite.REFL.preset.Override(preset.REFL.preset.value);
            }

            // Vignette
            if (preset.VIGN.enabled.value)
            {
                suite.VIGN.enabled.Override(preset.VIGN.enabled.value);
                suite.VIGN.mode.Override(VignetteMode.Classic);
                suite.VIGN.intensity.Override(preset.VIGN.intensity.value);
                suite.VIGN.smoothness.Override(preset.VIGN.smoothness.value);
                suite.VIGN.roundness.Override(preset.VIGN.roundness.value);
                suite.VIGN.rounded.Override(preset.VIGN.rounded.value);
            }
        }