using UnityEngine;

// A simple thing to easily stack multiple triggers under one object.
public class TriggerUtility : MonoBehaviour
{
	public delegate void OnTrigger(Collider other);

	public OnTrigger onEnter, onExit, onStay;

	public void SetBoxBounds(Bounds bounds) {
		BoxCollider coll = GetComponent<BoxCollider>();
		coll.isTrigger = true;
		coll.center = bounds.center;
		coll.size = bounds.size;
	}

	private void OnTriggerEnter(Collider other) {
		//if (other.transform != transform.parent)
			onEnter?.Invoke(other);
	}

	private void OnTriggerExit(Collider other) {
		//if (other.transform != transform.parent)
			onExit?.Invoke(other);
	}

	private void OnTriggerStay(Collider other) {
		//if (other.transform != transform.parent)
			onStay?.Invoke(other);
	}
}
