36 lines
939 B
C#
36 lines
939 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
namespace R0bbie.Timeline
|
|
{
|
|
/// <summary>
|
|
/// Generic TimelineTrigger which invokes an event, and keeps track if it was previously triggered
|
|
/// </summary>
|
|
public class TimelineTrigger : MonoBehaviour
|
|
{
|
|
// No functional impact - but allow giving this trigger a description so its clearer what it relates to on the component itself
|
|
[SerializeField] string description;
|
|
|
|
// Provide public subscribable trigger event
|
|
public UnityEvent<TimelineTrigger> onTrigger;
|
|
|
|
|
|
// Track whether previously triggered
|
|
public bool triggered { get; protected set; }
|
|
|
|
|
|
/// <summary>
|
|
/// On trigger
|
|
/// </summary>
|
|
public void Trigger()
|
|
{
|
|
triggered = true;
|
|
|
|
onTrigger.Invoke(this);
|
|
}
|
|
|
|
|
|
}
|
|
} |