private void FireEvent(USEventBase baseEvent, float prevElapsedTime, float elapsedTime) { if ((prevElapsedTime < baseEvent.FireTime || prevElapsedTime <= 0f) && elapsedTime >= baseEvent.FireTime && baseEvent.AffectedObject) { baseEvent.FireEvent(); } }
private void FireEventCommon(USEventBase baseEvent, float sequencerTime, float prevElapsedTime, float elapsedTime) { if (elapsedTime > baseEvent.FireTime && elapsedTime <= baseEvent.FireTime + baseEvent.Duration) { float deltaTime = sequencerTime - baseEvent.FireTime; if (baseEvent.AffectedObject) { baseEvent.ProcessEvent(deltaTime); } } if (prevElapsedTime < baseEvent.FireTime + baseEvent.Duration && elapsedTime >= baseEvent.FireTime + baseEvent.Duration) { if (baseEvent.AffectedObject) { float deltaTime = sequencerTime - baseEvent.FireTime; baseEvent.ProcessEvent(deltaTime); baseEvent.EndEvent(); } } if (prevElapsedTime >= baseEvent.FireTime && elapsedTime < baseEvent.FireTime) { if (baseEvent.AffectedObject) { baseEvent.UndoEvent(); } } }
/// <summary> /// This function will skip the timeline time to the time passed, any event that is flagged to fire when skipped /// (None by default) will not fired. /// </summary> public override void SkipTimelineTo(float time) { float prevElapsedTime = elapsedTime; elapsedTime = time; foreach (Transform child in transform) { USEventBase baseEvent = child.GetComponent <USEventBase>(); if (!baseEvent) { continue; } bool shouldSkipEvent = !baseEvent.IsFireAndForgetEvent || !baseEvent.FireOnSkip; if (shouldSkipEvent) { continue; } if ((prevElapsedTime < baseEvent.FireTime || prevElapsedTime <= 0.0f) && time > baseEvent.FireTime) { if (Sequence.IsPlaying && baseEvent.AffectedObject) { baseEvent.FireEvent(); } } } }
public override void Process(float sequencerTime, float playbackRate) { float num = this.elapsedTime; this.elapsedTime = sequencerTime; USEventBase[] events = this.Events; if (num < this.elapsedTime) { Array.Sort <USEventBase>(events, (USEventBase a, USEventBase b) => a.FireTime.CompareTo(b.FireTime)); } else { Array.Sort <USEventBase>(events, (USEventBase a, USEventBase b) => b.FireTime.CompareTo(a.FireTime)); } USEventBase[] array = events; for (int i = 0; i < array.Length; i++) { USEventBase baseEvent = array[i]; if (playbackRate >= 0f) { this.FireEvent(baseEvent, num, this.elapsedTime); } else { this.FireEventReverse(baseEvent, num, this.elapsedTime); } this.FireEventCommon(baseEvent, sequencerTime, num, this.elapsedTime); } }
public void Initialize(USEventBase evt) { Event = evt; // Use Reflection to find the Function we require and call it. var baseType = typeof(USEventBaseEditor); var foundType = baseType; var types = USEditorUtility.GetAllSubTypes(baseType); foreach (var type in types) { if (type.IsSubclassOf(baseType)) { foreach (Attribute attr in type.GetCustomAttributes(true)) { var eventAttr = attr as CustomUSEditorAttribute; if (eventAttr == null) { continue; } if (eventAttr.InspectedType == Event.GetType()) { foundType = type; } } } } eventEditor = CreateInstance(foundType) as USEventBaseEditor; eventEditor.TargetEvent = Event; }
public override void PauseTimeline() { USEventBase[] events = this.Events; for (int i = 0; i < events.Length; i++) { USEventBase uSEventBase = events[i]; uSEventBase.PauseEvent(); } }
public override void ResumeTimeline() { USEventBase[] events = this.Events; for (int i = 0; i < events.Length; i++) { USEventBase uSEventBase = events[i]; if (!uSEventBase.IsFireAndForgetEvent && base.Sequence.RunningTime > uSEventBase.FireTime && base.Sequence.RunningTime < uSEventBase.FireTime + uSEventBase.Duration) { uSEventBase.ResumeEvent(); } } }
private void Start() { USTimelineContainer[] array = this.TimelineContainers; for (int i = 0; i < array.Length; i++) { USTimelineContainer uSTimelineContainer = array[i]; if (uSTimelineContainer) { USTimelineBase[] timelines = uSTimelineContainer.Timelines; for (int j = 0; j < timelines.Length; j++) { USTimelineBase uSTimelineBase = timelines[j]; USTimelineEvent uSTimelineEvent = uSTimelineBase as USTimelineEvent; if (uSTimelineEvent) { USEventBase[] events = uSTimelineEvent.Events; for (int k = 0; k < events.Length; k++) { USEventBase uSEventBase = events[k]; uSEventBase.FixupAdditionalObjects(); } } USTimelineObserver uSTimelineObserver = uSTimelineBase as USTimelineObserver; if (uSTimelineObserver) { foreach (USObserverKeyframe current in uSTimelineObserver.observerKeyframes) { if (!(current.cameraPath == string.Empty)) { GameObject gameObject = GameObject.Find(current.cameraPath); if (gameObject) { Camera component = gameObject.GetComponent <Camera>(); if (component) { current.KeyframeCamera = component; } } } } } USTimelineObjectPath uSTimelineObjectPath = uSTimelineBase as USTimelineObjectPath; if (uSTimelineObjectPath) { uSTimelineObjectPath.FixupAdditionalObjects(); } } } } }
public USEventBase Event(int index) { if (index >= this.EventCount) { Debug.LogError("Trying to access an element in mEventList that does not exist from USTimelineEvent::Event"); return(null); } USEventBase component = base.transform.GetChild(index).GetComponent <USEventBase>(); if (!component) { Debug.LogWarning("We've requested an event that doesn't have a USEventBase component : " + component.name + " from timeline : " + base.name); } return(component); }
public override void ManuallySetTime(float sequencerTime) { foreach (Transform transform in base.transform) { USEventBase component = transform.GetComponent <USEventBase>(); if (component) { float deltaTime = sequencerTime - component.FireTime; if (component.AffectedObject) { component.ManuallySetTime(deltaTime); } } } }
public override void ManuallySetTime(float sequencerTime) { foreach (Transform child in transform) { USEventBase baseEvent = child.GetComponent <USEventBase>(); if (!baseEvent) { continue; } float deltaTime = sequencerTime - baseEvent.FireTime; if (baseEvent.AffectedObject) { baseEvent.ManuallySetTime(deltaTime); } } }
public override void SkipTimelineTo(float time) { float num = this.elapsedTime; this.elapsedTime = time; foreach (Transform transform in base.transform) { USEventBase component = transform.GetComponent <USEventBase>(); if (component) { bool flag = !component.IsFireAndForgetEvent || !component.FireOnSkip; if (!flag) { if ((num < component.FireTime || num <= 0f) && time > component.FireTime && base.Sequence.IsPlaying && component.AffectedObject) { component.FireEvent(); } } } } }
private void RemoveEvent(USEventBase baseEvent) { USUndoManager.RegisterCompleteObjectUndo(this, "Remove Event"); EventRenderData foundEventData = null; foreach (var cachedRenderData in cachedEventRenderData) { if (cachedRenderData.Event == baseEvent) { foundEventData = cachedRenderData; } } cachedEventRenderData.Remove(foundEventData); var removedGameObject = foundEventData.Event.gameObject; USUndoManager.DestroyImmediate(foundEventData); USUndoManager.DestroyImmediate(removedGameObject); }
public void AddNewEvent(USEventBase sequencerEvent) { sequencerEvent.transform.parent = transform; SortEvents(); }
private void FireEventReverse(USEventBase baseEvent, float prevElapsedTime, float elapsedTime) { }