blob: 1421de03f12d8115acf7f26a8bc66ac6bfdc8f22 (
plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
public class ArtHandler : MonoBehaviour
{
public ArtInstance[] arts;
public PostProcessVolume volume;
public static ArtHandler instance;
private ColorGrading colorGrading;
private int currentArt = -1;
private void Awake()
{
instance = this;
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.LeftShift))
{
NextArt();
}
}
public void NextArt()
{
for (int i = 0; i < arts.Length; i++)
{
arts[i].TogglePart(on: false);
}
int num = Random.Range(0, arts.Length);
if (num >= arts.Length)
{
num = 0;
}
ApplyArt(arts[num]);
}
private void ApplyArt(ArtInstance art)
{
art.TogglePart(on: true);
currentArt = GetArtID(art);
volume.profile = art.profile;
}
public void SetSpecificArt(ArtInstance art)
{
ApplyArt(art);
}
public void ApplyPost(PostProcessProfile profileToSet)
{
volume.profile = profileToSet;
}
public void SetSpecificArt(string artName)
{
for (int i = 0; i < arts.Length; i++)
{
if (arts[i].profile.name == artName)
{
ApplyArt(arts[i]);
break;
}
}
}
private int GetArtID(ArtInstance art)
{
int result = -1;
for (int i = 0; i < arts.Length; i++)
{
if (art == arts[i])
{
result = i;
}
}
return result;
}
}
|