using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class RangeDetection : MonoBehaviour { public UnityEvent EnterRange; public UnityEvent OutRange; public string triggerTag; private void Start() { if (triggerTag != "") return; triggerTag = "Player"; } private void OnTriggerEnter(Collider other) { if (GameManager.GetInstance().IsStartEvent) return; if (other.gameObject.tag==triggerTag) { EnterRange.Invoke(); } } private void OnTriggerExit(Collider other) { if (GameManager.GetInstance().IsStartEvent) return; if (other.gameObject.tag == triggerTag) { OutRange.Invoke(); } } }