25 lines
532 B
C#
25 lines
532 B
C#
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class PlayerEvent : MonoBehaviour
|
|
{
|
|
public UnityEvent OnPlayerEnter;
|
|
public UnityEvent OnPlayerExit;
|
|
|
|
void OnTriggerEnter(Collider col)
|
|
{
|
|
if (Player.Instance && col.gameObject == Player.Instance.gameObject)
|
|
{
|
|
OnPlayerEnter?.Invoke();
|
|
}
|
|
}
|
|
|
|
void OnTriggerExit(Collider col)
|
|
{
|
|
if (Player.Instance && col.gameObject == Player.Instance.gameObject)
|
|
{
|
|
OnPlayerExit?.Invoke();
|
|
}
|
|
}
|
|
}
|