summaryrefslogtreecommitdiff
path: root/GameCode/ProjectileFX.cs
blob: df82c3d36bce3e893dd3b4921c6db632ba6a9910 (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
using System.Collections;
using UnityEngine;

public class ProjectileFX : MonoBehaviour
{
	[SerializeField]
	private GameObject bleedingPS;

	[SerializeField]
	private GameObject burrningPS;

	[SerializeField]
	private GameObject poisonPS;

	public void SetFX(float bleeding, float burning, float poison, float slow, bool arcane)
	{
		if (OptionsMenu.instance.extraProjectileEffects)
		{
			if (bleeding > 0f)
			{
				bleedingPS.SetActive(value: true);
			}
			if (burning > 0f)
			{
				burrningPS.SetActive(value: true);
			}
			if (poison > 0f)
			{
				poisonPS.SetActive(value: true);
			}
		}
	}

	public void OnDetach()
	{
		StartCoroutine(Die());
	}

	private IEnumerator Die()
	{
		bleedingPS.GetComponent<ParticleSystem>().Stop(withChildren: true);
		burrningPS.GetComponent<ParticleSystem>().Stop(withChildren: true);
		poisonPS.GetComponent<ParticleSystem>().Stop(withChildren: true);
		yield return new WaitForSeconds(1.1f);
		Object.Destroy(base.gameObject);
	}
}