summaryrefslogtreecommitdiff
path: root/GameCode/Explosion.cs
blob: a01aa1749d234b1ecff409421ec487f641228987 (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
using UnityEngine;

public class Explosion : MonoBehaviour
{
	[SerializeField]
	private float duration = 2f;

	[SerializeField]
	private Sound sound;

	private void Start()
	{
		if (sound != 0)
		{
			SFXManager.instance.PlaySound(sound, base.transform.position);
		}
	}

	private void FixedUpdate()
	{
		duration -= Time.fixedDeltaTime;
		if (duration <= 0f)
		{
			Object.Destroy(base.gameObject);
		}
	}
}