using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.Serialization; public class Radar : MonoBehaviour { [System.Serializable] public class SearchedEvent : UnityEvent { } [FormerlySerializedAs("onSearched")] [SerializeField] [Space(10)] private SearchedEvent OnSearched = new SearchedEvent(); private void OnTriggerEnter(Collider other) { if (other.CompareTag("Radar") || other.CompareTag("Bomb")) return; OnSearched.Invoke(other.transform, true); } private void OnTriggerExit(Collider other) { if (other.CompareTag("Radar") || other.CompareTag("Bomb")) return; OnSearched.Invoke(other.transform, false); } }