blob: a58db0240c6b854677e86a30f9de06d911b5522d (
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
 | using UnityEngine;
public class PlayerFlyParticle : MonoBehaviour
{
	private ParticleSystem part;
	private HealthHandler health;
	private void Start()
	{
		part = GetComponent<ParticleSystem>();
		health = GetComponentInParent<HealthHandler>();
	}
	private void Update()
	{
		if (part.isPlaying)
		{
			if (health.flyingFor < 0f)
			{
				part.Stop();
			}
		}
		else if (health.flyingFor > 0f)
		{
			part.Play();
		}
	}
}
 |