private void addNewCurveItem(MultiCurveTrack track)
 {
     Undo.RegisterCreatedObjectUndo(CutsceneItemFactory.CreateMultiActorClipCurve(track), "Created Multi Actor Clip Curve");
 }
 public PasteContext(Vector2 mousePosition, MultiCurveTrack track)
 {
     this.mousePosition = mousePosition;
     this.track = track;
 }
    internal static CinemaMultiActorCurveClip CreateMultiActorClipCurve(MultiCurveTrack multiCurveTrack)
    {
        string name = DirectorHelper.getCutsceneItemName(multiCurveTrack.gameObject, CURVE_CLIP_NAME_DEFAULT, typeof(CinemaMultiActorCurveClip));
        GameObject item = new GameObject(name);
        item.transform.parent = multiCurveTrack.transform;
        CinemaMultiActorCurveClip clip = item.AddComponent<CinemaMultiActorCurveClip>();

        SortedDictionary<float, CinemaMultiActorCurveClip> sortedItems = new SortedDictionary<float, CinemaMultiActorCurveClip>();
        foreach (CinemaMultiActorCurveClip c in multiCurveTrack.TimelineItems)
        {
            sortedItems.Add(c.Firetime, c);
        }

        float latestTime = 0;
        float length = DEFAULT_CURVE_LENGTH;
        foreach (CinemaMultiActorCurveClip c in sortedItems.Values)
        {
            if (latestTime >= c.Firetime)
            {
                latestTime = Mathf.Max(latestTime, c.Firetime + c.Duration);
            }
            else
            {
                length = c.Firetime - latestTime;
                break;
            }
        }

        clip.Firetime = latestTime;
        clip.Duration = length;

        return clip;
    }