You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
807 B
30 lines
807 B
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<Transform, bool> { } |
|
[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); |
|
} |
|
}
|
|
|