using UnityEngine; namespace CinemaDirector { /// /// The basic building block of a Cutscene. Maintains a firetime /// [ExecuteInEditMode] public abstract class TimelineItem : MonoBehaviour { [SerializeField] protected float firetime = 0f; /// /// The firetime for this timeline item. Cannot be negative. /// public float Firetime { get { return this.firetime; } set { firetime = value; if (firetime < 0f) { firetime = 0f; } } } /// /// Called when a cutscene begins or enters preview mode. /// public virtual void Initialize() { } /// /// Called when a cutscene ends or exits preview mode. /// public virtual void Stop() { } /// /// Called when a new timeline item is created from the Director panel. /// Override to set defaults to your timeline items. /// public virtual void SetDefaults() { } /// /// Called when a new timeline item is created from the Director panel with a paired item. /// Override to set defaults to your timeline items. /// /// The paired item of this timeline item. public virtual void SetDefaults(UnityEngine.Object PairedItem) { } /// /// The cutscene that this timeline item is associated with. Can return null. /// public Cutscene Cutscene { get { return ((this.TimelineTrack == null) ? null : this.TimelineTrack.Cutscene); } } /// /// The track that this timeline item is associated with. Can return null. /// public TimelineTrack TimelineTrack { get { TimelineTrack track = null; if (transform.parent != null) { track = base.transform.parent.GetComponentInParent(); if (track == null) { Debug.LogError("No TimelineTrack found on parent!", this); } } else { Debug.LogError("Timeline Item has no parent!", this); } return track; } } } }