internal static CinemaGlobalEvent CreateGlobalEvent(GlobalItemTrack track, Type type, string name, float firetime) { GameObject item = new GameObject(name); item.transform.parent = track.transform; CinemaGlobalEvent globalEvent = item.AddComponent(type) as CinemaGlobalEvent; globalEvent.Firetime = firetime; return globalEvent; }
public static CinemaGlobalAction CreateGlobalAction(GlobalItemTrack track, Type type, string name, float firetime) { GameObject item = new GameObject(name); CinemaGlobalAction action = item.AddComponent(type) as CinemaGlobalAction; SortedDictionary<float, CinemaGlobalAction> sortedActions = new SortedDictionary<float, CinemaGlobalAction>(); foreach (CinemaGlobalAction a in track.Actions) { sortedActions.Add(a.Firetime, a); } float latestTime = firetime; float length = DEFAULT_GLOBAL_ACTION_LENGTH; foreach (CinemaGlobalAction a in sortedActions.Values) { if (latestTime >= a.Firetime) { latestTime = Mathf.Max(latestTime, a.Firetime + a.Duration); } else { length = a.Firetime - latestTime; break; } } action.Firetime = latestTime; action.Duration = length; item.transform.parent = track.transform; return action; }