35 lines
725 B
C#
35 lines
725 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;
|
|
|
|
[ContextMenu("Debug Checkpoint")]
|
|
public void CheckPointPass(Collider collider)
|
|
{
|
|
OnCheckpointPass?.Invoke();
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
_splineTrigger = GetComponentInChildren<SplineTrigger>();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
_splineTrigger.OnTriggerEvent.AddListener(CheckPointPass);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
_splineTrigger.OnTriggerEvent.RemoveListener(CheckPointPass);
|
|
}
|
|
|
|
}
|