using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.PostProcessing; public class PostProcessingUtility { static Dictionary postProcessingBehaviours = new Dictionary(); public static void RegisterPostProcessing(PPType _type, PostProcessingBehaviour _behaviour) { postProcessingBehaviours[_type] = _behaviour; } public static void TogglePostProcessing(bool _enable) { foreach (var behaviour in postProcessingBehaviours.Values) { behaviour.enabled = _enable; } } public static void SetSceneBloomIntensity(float _intensity) { if (postProcessingBehaviours.ContainsKey(PPType.Scene)) { var behaviour = postProcessingBehaviours[PPType.Scene]; if (behaviour != null && behaviour.profile != null) { if (_intensity > 0.1f) { behaviour.profile.bloom.enabled = true; var settings = behaviour.profile.bloom.settings; var bloomSettings = settings.bloom; bloomSettings.intensity = _intensity; settings.bloom = bloomSettings; behaviour.profile.bloom.settings = settings; } else { behaviour.profile.bloom.enabled = false; } } } } }