少年修仙传客户端代码仓库
leonard Wu
2018-08-07 28a16bc08b937f12031c1f4af0da4ac924fbc212
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.PostProcessing;
 
public class PostProcessingUtility
{
    static Dictionary<PPType, PostProcessingBehaviour> postProcessingBehaviours = new Dictionary<PPType, PostProcessingBehaviour>();
 
    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;
                }
 
            }
 
        }
 
    }
 
}