32 lines
885 B
C#
32 lines
885 B
C#
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class CarBipScript : MonoBehaviour
|
|
{
|
|
[HideInInspector]
|
|
public UnityEvent<HitDetectorScript> PlayerEntered = new UnityEvent<HitDetectorScript>();
|
|
|
|
[HideInInspector]
|
|
public UnityEvent<HitDetectorScript> PlayerExited = new UnityEvent<HitDetectorScript>();
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Player")
|
|
{
|
|
Debug.Log("Player Enter");
|
|
HitDetectorScript hit = other.GetComponent<HitDetectorScript>();
|
|
PlayerEntered.Invoke(hit);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (other.gameObject.tag == "Player")
|
|
{
|
|
Debug.Log("Player Exit");
|
|
HitDetectorScript hit = other.GetComponent<HitDetectorScript>();
|
|
PlayerExited.Invoke(hit);
|
|
}
|
|
}
|
|
}
|