void CreateEventFile(string clipName) { FxEvents fxEvents = new FxEvents(); fxEvents.events[0].eventMessage = -1; string fullPath = ClipNameToXmlFullPath(clipName); ChpLibXML.Save<FxEvents>(fxEvents, fullPath); Debug.Log(string.Format("createEventFile: {0}", fullPath)); }
void AddEventToClip(AnimationClip clip, FxEvents fxEvents) { List<AnimationEvent> aniEvents = new List<AnimationEvent>(); foreach (FxEvent evt in thisTarget.currentEvents.events) { AnimationEvent aEvt = new AnimationEvent(); aEvt.functionName = AnimationEventHolder.defaultFunctionName; aEvt.time = evt.time; aEvt.intParameter = evt.eventMessage; aEvt.messageOptions = SendMessageOptions.DontRequireReceiver; aniEvents.Add(aEvt); } AnimationUtility.SetAnimationEvents(clip, aniEvents.ToArray()); }
void AddAllEventsToClip() { AnimationClip[] clips = new AnimationClip[0]; FxEvents[] events = new FxEvents[0]; for (int i = 0; i < clips.Length; i++) { AddEventToClip(clips[i], events[i]); } }