// Sets up fabula timeline public void InstantiateFabulaTimeline(UnityPlanExecutor executePlanScript) { double startTime = 0; startTime = ProcessInstructionsForUnityAction(executePlanScript, action, unityAction, terms, startTime); ProcessInstructionsForUnityAction(executePlanScript, action2, unityAction2, terms2, startTime); }
public static double ProcessInstructionsForUnityAction(UnityPlanExecutor ep, GameObject a, UnityActionOperator ua, List <GameObject> actionTerms, double startTime) { var instructions = ua.UnityInstructions; double accumulatedTime = 0; foreach (var instruction in instructions) { var thisCI = ep.ProcessInstruction(a, instruction, actionTerms, startTime + accumulatedTime, 1); accumulatedTime += 1; } startTime = startTime + accumulatedTime; return(startTime); }
public void ExecuteTest() { // first, set all gameobjects not listed to false. var actorHost = GameObject.FindGameObjectWithTag("ActorHost"); var irrelevantActorStorage = new List <GameObject>(); for (int i = 0; i < actorHost.transform.childCount; i++) { var ithChild = actorHost.transform.GetChild(i); if (!terms.Contains(ithChild.gameObject) && !terms2.Contains(ithChild.gameObject)) { irrelevantActorStorage.Add(ithChild.gameObject); ithChild.gameObject.SetActive(false); } } // set starting position of relevant objects SetInitial(unityAction); var discExecutePlanObject = GameObject.FindGameObjectWithTag("DiscourseTimeline"); discExecutePlanScript = discExecutePlanObject.GetComponent <CamPlan>(); var fabExecutePlanObject = GameObject.FindGameObjectWithTag("ExecuteTimeline"); fabExecutePlanScript = fabExecutePlanObject.GetComponent <UnityPlanExecutor>(); // Instantiate Timeline Components fabExecutePlanScript.InstantiateExternally(); // Create Action InstantiateFabulaTimeline(fabExecutePlanScript); // Start Execution fabExecutePlanScript.ExecuteExternally(); // Test if camera shot is suitable for a transition to a next action. discExecutePlanScript.InitiateExternally(); // reference cinemachine virtual cam var cvc = camObject.GetComponent <CinemachineVirtualCamera>(); cvc.m_LookAt = terms[0].transform; camObject.GetComponent <CinemachineCameraBody>().FocusTransform = terms[0].transform; // create clip starting at 0 and lasting for arbitrary time discExecutePlanScript.AddClip(cvc, fabExecutePlanObject.GetComponent <PlayableDirector>(), 0, 0, 10, camObject.name); // Start Execution discExecutePlanScript.ExecuteExternally(); }