internal static CinemaActorAction CreateActorAction(ActorItemTrack track, Type type, string name, float firetime) { GameObject item = new GameObject(name); item.transform.parent = track.transform; CinemaActorAction action = item.AddComponent(type) as CinemaActorAction; SortedDictionary <float, CinemaActorAction> sortedActions = new SortedDictionary <float, CinemaActorAction>(); foreach (CinemaActorAction a in track.ActorActions) { sortedActions.Add(a.Firetime, a); } float latestTime = 0; float length = DEFAULT_ACTOR_ACTION_LENGTH; foreach (CinemaActorAction 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; return(action); }
public override void Draw(DirectorControlState state) { CinemaActorAction action = Wrapper.Behaviour as CinemaActorAction; if (action == null) { return; } if (IsSelected) { GUI.Box(controlPosition, GUIContent.none, TimelineTrackControl.styles.ActorTrackItemSelectedStyle); } else { GUI.Box(controlPosition, GUIContent.none, TimelineTrackControl.styles.ActorTrackItemStyle); } DrawRenameLabel(action.name, controlPosition); }