Elin Decompiled Documentation EA 23.102 Nightly
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
ScreenEffect.cs
Go to the documentation of this file.
1using UnityEngine;
2
3public class ScreenEffect : EMono
4{
5 public bool worldParticle;
6
7 public float killDuration;
8
9 public float stopParticleTime;
10
11 private GameObject goParent;
12
13 private float time;
14
15 private bool particleStopped;
16
17 public static void Play(string id)
18 {
19 Util.Instantiate<ScreenEffect>("Media/Effect/ScreenEffect/" + id, Camera.main.transform);
20 }
21
22 private void Awake()
23 {
24 if ((bool)base.transform.parent)
25 {
26 goParent = base.transform.parent.gameObject;
27 }
28 base.transform.SetParent(Camera.main.transform, worldPositionStays: false);
29 if (worldParticle)
30 {
31 ParticleSystem[] componentsInChildren = GetComponentsInChildren<ParticleSystem>();
32 for (int i = 0; i < componentsInChildren.Length; i++)
33 {
34 ParticleSystem.MainModule main = componentsInChildren[i].main;
35 main.simulationSpace = ParticleSystemSimulationSpace.World;
36 }
37 }
38 }
39
40 private void Update()
41 {
42 if ((bool)goParent)
43 {
44 return;
45 }
46 time += Time.unscaledDeltaTime;
48 {
49 ParticleSystem[] componentsInChildren = GetComponentsInChildren<ParticleSystem>();
50 foreach (ParticleSystem particleSystem in componentsInChildren)
51 {
52 if (particleSystem.transform.tag.Contains("ParticleEmitter"))
53 {
54 ParticleSystem.MainModule main = particleSystem.main;
55 main.loop = false;
56 ParticleSystem.EmissionModule emission = particleSystem.emission;
57 emission.enabled = false;
58 }
59 }
60 SoundEmitter[] componentsInChildren2 = GetComponentsInChildren<SoundEmitter>();
61 foreach (SoundEmitter soundEmitter in componentsInChildren2)
62 {
63 if ((bool)soundEmitter.source)
64 {
65 soundEmitter.source.Stop(2f);
66 soundEmitter.source = null;
67 }
68 }
69 particleStopped = true;
70 }
71 if (time > killDuration)
72 {
73 Object.Destroy(base.gameObject);
74 }
75 }
76}
Definition: EMono.cs:4
float killDuration
Definition: ScreenEffect.cs:7
void Awake()
Definition: ScreenEffect.cs:22
static void Play(string id)
Definition: ScreenEffect.cs:17
GameObject goParent
Definition: ScreenEffect.cs:11
void Update()
Definition: ScreenEffect.cs:40
float stopParticleTime
Definition: ScreenEffect.cs:9
bool worldParticle
Definition: ScreenEffect.cs:5
bool particleStopped
Definition: ScreenEffect.cs:15