summaryrefslogtreecommitdiff
path: root/GameCode/DestroyEvent.cs
blob: 2e4fe6306e9137f7feb67f97194154286bbe4fea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using UnityEngine;
using UnityEngine.Events;

public class DestroyEvent : MonoBehaviour
{
	public UnityEvent deathEvent;

	private bool m_isQuitting;

	private void OnDestroy()
	{
		if (!m_isQuitting)
		{
			deathEvent.Invoke();
		}
	}

	private void OnApplicationQuit()
	{
		m_isQuitting = true;
	}
}