using UnityEngine; namespace CinemaDirector { /// /// A track designed to hold Actor Curve Clip items. /// [TimelineTrackAttribute("Curve Track", TimelineTrackGenre.ActorTrack, CutsceneItemGenre.CurveClipItem)] public class CurveTrack : TimelineTrack, IActorTrack { /// /// Update all curve items. /// /// The new running time. /// The deltaTime since last update. public override void UpdateTrack(float time, float deltaTime) { base.elapsedTime = time; foreach (CinemaActorClipCurve actorClipCurve in this.TimelineItems) { actorClipCurve.SampleTime(time); } } /// /// Set the track to an arbitrary time. /// /// The new running time. public override void SetTime(float time) { base.elapsedTime = time; foreach (CinemaActorClipCurve actorClipCurve in this.TimelineItems) { actorClipCurve.SampleTime(time); } } /// /// Stop and reset all the curve data. /// public override void Stop() { foreach (CinemaActorClipCurve actorClipCurve in this.TimelineItems) { actorClipCurve.Reset(); } } /// /// Get the Actor associated with this Curve Track. /// public Transform Actor { get { ActorTrackGroup atg = this.TrackGroup as ActorTrackGroup; if (atg == null) { Debug.LogError("No ActorTrackGroup found on parent.", this); return null; } return atg.Actor; } } } }