MayHeCome/Assets/Scripts/TriggerDetection.cs
2024-12-18 17:55:34 +08:00

26 lines
569 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TriggerDetection : MonoBehaviour
{
public Action<Collider> onTriggerEnter;
public Action<Collider> onTriggerStay;
public Action<Collider> onTriggerExit;
private void OnTriggerEnter(Collider other)
{
onTriggerEnter?.Invoke(other);
}
private void OnTriggerStay(Collider other)
{
onTriggerStay?.Invoke(other);
}
private void OnTriggerExit(Collider other)
{
onTriggerExit?.Invoke(other);
}
}