/// <summary> /// Gets the UI content for a specific category. /// </summary> /// <param name="category">The content category (Dialogue, Journal, etc.).</param> /// <returns>A list of UI content items based on the current state of the quest and all of its nodes.</returns> public List <QuestContent> GetContentList(QuestContentCategory category) { if (!IsContentValidForCurrentSpeaker(category)) { return(null); } var stateInfo = QuestStateInfo.GetStateInfo(stateInfoList, m_state); return((stateInfo != null) ? stateInfo.GetContentList(category) : null); }
public void SetRuntimeNodeReferences() { var stateCount = Enum.GetNames(typeof(QuestNodeState)).Length; for (int i = 0; i < stateCount; i++) { var stateInfo = QuestStateInfo.GetStateInfo(stateInfoList, (QuestNodeState)i); if (stateInfo != null) { stateInfo.SetRuntimeReferences(quest, this); } } }
/// <summary> /// Checks if there is any UI content for a specific category. /// </summary> /// <param name="category">The content category (Dialogue, Journal, etc.).</param> /// <returns>True if GetContentList would return anything.</returns> public bool HasContent(QuestContentCategory category) { if (!IsContentValidForCurrentSpeaker(category)) { return(false); } var stateInfo = QuestStateInfo.GetStateInfo(stateInfoList, m_state); if (stateInfo == null) { return(false); } var contentList = stateInfo.GetContentList(category); return(contentList != null && contentList.Count > 0); }
/// <summary> /// Returns the state info associated with a quest node state. /// </summary> public QuestStateInfo GetStateInfo(QuestNodeState state) { return((stateInfoList != null) ? QuestStateInfo.GetStateInfo(stateInfoList, state) : null); }
/// <summary> /// Sets sub-objects' runtime references to this quest. /// </summary> public void SetRuntimeReferences() { // Set references in start info: if (Application.isPlaying) { m_timeCooldownLastChecked = GameTime.time; } if (autostartConditionSet != null) { autostartConditionSet.SetRuntimeReferences(this, null); } if (offerConditionSet != null) { offerConditionSet.SetRuntimeReferences(this, null); } QuestContent.SetRuntimeReferences(offerConditionsUnmetContentList, this, null); QuestContent.SetRuntimeReferences(offerContentList, this, null); // Set references in counters: if (counterList != null) { for (int i = 0; i < counterList.Count; i++) { counterList[i].SetRuntimeReferences(this); } } // Set references in state info: if (stateInfoList != null) { for (int i = 0; i < stateInfoList.Count; i++) { var stateInfo = QuestStateInfo.GetStateInfo(stateInfoList, (QuestState)i); if (stateInfo != null) { stateInfo.SetRuntimeReferences(this, null); } } } // Set references in nodes: if (nodeList != null) { for (int i = 0; i < nodeList.Count; i++) { if (nodeList[i] != null) { nodeList[i].InitializeRuntimeReferences(this); } } for (int i = 0; i < nodeList.Count; i++) { if (nodeList[i] != null) { nodeList[i].ConnectRuntimeNodeReferences(); } } for (int i = 0; i < nodeList.Count; i++) { if (nodeList[i] != null) { nodeList[i].SetRuntimeNodeReferences(); } } } // Record list of any nodes' speakers who aren't the quest giver: RecordSpeakersUsedInQuestAndAnyNodes(); // Add tags to dictionary: QuestMachineTags.AddTagsToDictionary(tagDictionary, title); QuestMachineTags.AddTagsToDictionary(tagDictionary, group); if (!StringField.IsNullOrEmpty(questGiverID)) { tagDictionary.SetTag(QuestMachineTags.QUESTGIVERID, questGiverID); } }