Checkpoint
This commit is contained in:
24
Assets/Content/Scripts/PlayerEvent.cs
Normal file
24
Assets/Content/Scripts/PlayerEvent.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user