public static RuntimeActionList RunActionListAsset(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue) { if (actionListAsset != null && actionListAsset.actions.Count > 0) { GameObject runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList)); RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>(); runtimeActionList.DownloadActions(actionListAsset, endConversation, i, doSkip, addToSkipQueue); return(runtimeActionList); } return(null); }
/** * <summary>Resumes a previously-paused ActionListAsset. If the ActionListAsset is already running, nothing will happen.</summary> * <param name = "actionListAsset">The ActionListAsset to pause</param> * <param name = "rerunPausedActions">If True, then any Actions that were midway-through running when the ActionList was paused will be restarted. Otherwise, the Actions that follow them will be reun instead.</param> */ public void Resume(ActionListAsset actionListAsset, bool rerunPausedActions) { if (IsListRunning(actionListAsset) && !actionListAsset.canRunMultipleInstances) { return; } bool foundInstance = false; for (int i = 0; i < activeLists.Count; i++) { if (activeLists[i].IsFor(actionListAsset)) { int numInstances = 0; foreach (ActiveList activeList in activeLists) { if (activeList.IsFor(actionListAsset) && activeList.IsRunning()) { numInstances++; } } GameObject runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList)); runtimeActionListObject.name = actionListAsset.name; if (numInstances > 0) { runtimeActionListObject.name += " " + numInstances.ToString(); } RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>(); runtimeActionList.DownloadActions(actionListAsset, activeLists[i].GetConversationOnEnd(), activeLists[i].startIndex, false, activeLists[i].inSkipQueue, true); activeLists[i].Resume(runtimeActionList, rerunPausedActions); foundInstance = true; if (!actionListAsset.canRunMultipleInstances) { return; } } } if (!foundInstance) { ACDebug.LogWarning("No resume data found for '" + actionListAsset + "' - running from start.", actionListAsset); AdvGame.RunActionListAsset(actionListAsset); } }
/** * <summary>Runs or skips an ActionList asset file.</summary> * <param name = "actionListAsset">The ActionList asset to run</param> * <param name = "endConversation">The Conversation to enable when the ActionList is complete</param> * <param name = "i">The index of the Action to start from</param> * <param name = "doSkip">If True, all Actions within the ActionList will be run and completed instantly.</param> * <param name = "addToSkipQueue">True if the ActionList should be added to the skip queue</param> * <returns>The temporary RuntimeActionList object in the scene that performs the Actions within the asset</returns> */ public static RuntimeActionList RunActionListAsset(ActionListAsset actionListAsset, Conversation endConversation, int i, bool doSkip, bool addToSkipQueue) { if (actionListAsset != null && actionListAsset.actions.Count > 0) { GameObject runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList)); RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>(); runtimeActionList.DownloadActions(actionListAsset, endConversation, i, doSkip, addToSkipQueue); GameObject cutsceneFolder = GameObject.Find("_Cutscenes"); if (cutsceneFolder != null && cutsceneFolder.transform.position == Vector3.zero) { runtimeActionList.transform.parent = cutsceneFolder.transform; } return(runtimeActionList); } return(null); }
/** * <summary>Resumes a previously-paused ActionListAsset. If the ActionListAsset is already running, nothing will happen.</summary> * <param name = "actionListAsset">The ActionListAsset to pause</param> */ public void Resume(ActionListAsset actionListAsset) { if (IsListRunning(actionListAsset)) { return; } for (int i = 0; i < activeLists.Count; i++) { if (activeLists[i].IsFor(actionListAsset)) { GameObject runtimeActionListObject = (GameObject)Instantiate(Resources.Load(Resource.runtimeActionList)); RuntimeActionList runtimeActionList = runtimeActionListObject.GetComponent <RuntimeActionList>(); runtimeActionList.DownloadActions(actionListAsset, activeLists[i].GetConversationOnEnd(), activeLists[i].startIndex, false, activeLists[i].inSkipQueue, true); activeLists[i].Resume(runtimeActionList); return; } } AdvGame.RunActionListAsset(actionListAsset); }