-
Notifications
You must be signed in to change notification settings - Fork 0
/
visibility.cs
168 lines (116 loc) · 3.18 KB
/
visibility.cs
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
using UnityEngine;
using System.Collections;
public class visibility : MonoBehaviour {
public static string act1="1";
public static string act2="2";
public static string act3="3";
public static string act4="4";
public static string act5="x";
public static string act6="6";
public static float rate;
private float drk =0f;
private float tr=1f;
// Use this for initialization
void Start () { //remembering all emissionrates
rate=this.GetComponent<ParticleSystem>().emissionRate;
}
void OnGUI(){//activating clouds when corresponding btn was pressed
if (this.name=="cloud1"){
if (GUI.Button(new Rect(30,30,20,20),act1)){
this.GetComponent<Renderer>().enabled=true;
act1="x";
act2="2";
act3="3";
act4="4";
act5="5";
act6="6";
}
}
if (this.name=="cloud2"){
if (GUI.Button(new Rect(60,30,20,20),act2)){
this.GetComponent<Renderer>().enabled=true;
act1="1";
act2="x";
act3="3";
act4="4";
act5="5";
act6="6";
}
}
if (this.name=="cloud3"){
if (GUI.Button(new Rect(90,30,20,20),act3)){
this.GetComponent<Renderer>().enabled=true;
act1="1";
act2="2";
act3="x";
act4="4";
act5="5";
act6="6";
}
}
if (this.name=="cloud4"){
if (GUI.Button(new Rect(120,30,20,20),act4)){
this.GetComponent<Renderer>().enabled=true;
act1="1";
act2="2";
act3="3";
act4="x";
act5="5";
act6="6";
}
}
if (this.name=="cloud5"){
if (GUI.Button(new Rect(150,30,20,20),act5)){
this.GetComponent<Renderer>().enabled=true;
act1="1";
act2="2";
act3="3";
act4="4";
act5="x";
act6="6";
}
}
if (this.name=="cloud6"){
if (GUI.Button(new Rect(180,30,20,20),act6)){
this.GetComponent<Renderer>().enabled=true;
act1="1";
act2="2";
act3="3";
act4="4";
act5="5";
act6="x";
}
}
}
// Update is called once per frame
void Update () {
if (tr!=transparency.density){
tr=transparency.density;
this.GetComponent<ParticleSystem>().emissionRate = rate*tr;
print(tr);
}
if (drk!=transparency.darkness){
drk=transparency.darkness;
this.GetComponent<Renderer>().material.SetColor("_TintColor", new Color(1f-drk,1f-drk,1f-drk,this.GetComponent<Renderer>().material.GetColor("_TintColor").a));
print(tr);
}
if (this.name=="cloud1" && this.GetComponent<Renderer>().enabled==true && act1=="1"){
this.GetComponent<Renderer>().enabled=false;
}
if (this.name=="cloud2" && this.GetComponent<Renderer>().enabled==true && act2=="2"){
this.GetComponent<Renderer>().enabled=false;
}
if (this.name=="cloud3" && this.GetComponent<Renderer>().enabled==true && act3=="3"){
this.GetComponent<Renderer>().enabled=false;
}
if (this.name=="cloud4" && this.GetComponent<Renderer>().enabled==true && act4=="4"){
this.GetComponent<Renderer>().enabled=false;
}
if (this.name=="cloud5" && this.GetComponent<Renderer>().enabled==true && act5=="5"){
this.GetComponent<Renderer>().enabled=false;
}
if (this.name=="cloud6" && this.GetComponent<Renderer>().enabled==true && act6=="6"){
this.GetComponent<Renderer>().enabled=false;
}
}
}