41 lines
801 B
C#
41 lines
801 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.Playables;
|
|
|
|
public class CheckPoint : MonoBehaviour
|
|
{
|
|
public UnityEvent OnCheckpointPass;
|
|
|
|
private SplineTrigger _splineTrigger;
|
|
|
|
|
|
public void CheckPointPass(Collider collider)
|
|
{
|
|
OnCheckpointPass?.Invoke();
|
|
}
|
|
|
|
[ContextMenu("Debug Checkpoint")]
|
|
public void DebugPass()
|
|
{
|
|
CheckPointPass(null);
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
_splineTrigger = GetComponentInChildren<SplineTrigger>();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
_splineTrigger.OnTriggerEvent.AddListener(CheckPointPass);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
_splineTrigger.OnTriggerEvent.RemoveListener(CheckPointPass);
|
|
}
|
|
|
|
}
|