2023-07-28 11:48:57 +03:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.Events;
|
|
|
|
using UnityEngine.Playables;
|
|
|
|
|
|
|
|
public class CheckPoint : MonoBehaviour
|
|
|
|
{
|
|
|
|
public UnityEvent OnCheckpointPass;
|
|
|
|
|
2023-08-15 17:38:54 +03:00
|
|
|
private SplineTrigger _splineTrigger;
|
|
|
|
|
2023-10-17 12:37:34 +03:00
|
|
|
|
2023-10-02 19:12:35 +03:00
|
|
|
public void CheckPointPass(Collider collider)
|
2023-07-28 11:48:57 +03:00
|
|
|
{
|
|
|
|
OnCheckpointPass?.Invoke();
|
|
|
|
}
|
2023-08-15 17:38:54 +03:00
|
|
|
|
2023-10-17 12:37:34 +03:00
|
|
|
[ContextMenu("Debug Checkpoint")]
|
|
|
|
public void DebugPass()
|
|
|
|
{
|
|
|
|
CheckPointPass(null);
|
|
|
|
}
|
|
|
|
|
2023-08-15 17:38:54 +03:00
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
_splineTrigger = GetComponentInChildren<SplineTrigger>();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
{
|
|
|
|
_splineTrigger.OnTriggerEvent.AddListener(CheckPointPass);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnDisable()
|
|
|
|
{
|
|
|
|
_splineTrigger.OnTriggerEvent.RemoveListener(CheckPointPass);
|
|
|
|
}
|
|
|
|
|
2023-07-28 11:48:57 +03:00
|
|
|
}
|