rabidus-test/Assets/Scripts/CheckPoint.cs

35 lines
708 B
C#
Raw Normal View History

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-07-28 11:48:57 +03:00
[ContextMenu("Debug Checkpoint")]
public void CheckPointPass()
{
OnCheckpointPass?.Invoke();
}
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
}