コード例 #1
0
    internal static CinemaActorEvent CreateActorEvent(ActorItemTrack track, Type type, string name, float firetime)
    {
        GameObject item = new GameObject(name);
        item.transform.parent = track.transform;
        CinemaActorEvent actorEvent = item.AddComponent(type) as CinemaActorEvent;

        actorEvent.Firetime = firetime;

        return actorEvent;
    }
コード例 #2
0
    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;

    }