-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParticleDestroy.cs
More file actions
42 lines (31 loc) · 772 Bytes
/
Copy pathParticleDestroy.cs
File metadata and controls
42 lines (31 loc) · 772 Bytes
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
using UnityEngine;
using System.Collections;
public class ParticleDestroy : MonoBehaviour {
public ParticleSystem part;
private bool waitDelay = true;
// Use this for initialization
void Start () {
part = this.gameObject.GetComponentInChildren<ParticleSystem>();
}
// Update is called once per frame
void Update () {
if (part.IsAlive())
{
}
else
{
if (waitDelay == true)
{
StartCoroutine(TimeDelay(1.0f));
}
else
Destroy(this.gameObject);
}
}
IEnumerator TimeDelay(float timedelay)
{
waitDelay = true;
yield return new WaitForSeconds(timedelay);
waitDelay = false;
}
}