protected override void OnWentOutOfRange() { if (currentUsedWindow != null) { currentUsedWindow.Close(); QuestTrigger.currentUsedWindow = null; } }
public override bool Use() { //Can the trigger be used? if (!CanUse()) { return(false); } //Set the trigger in use this.InUse = true; currentUsedWindow = QuestManager.UI.questWindow; //currentUsedWindow.Show(GetNextQuest()); for (int i = 0; i < this.m_QuestCollection.Count; i++) { Quest quest = this.m_QuestCollection[i]; if (quest.CanComplete()) { currentUsedWindow.Show(quest); return(true); } } string[] quests = this.m_QuestCollection.Where(x => x.CanActivate()).Select(y => y.Name).ToArray(); if (quests.Length > 1) { DialogBox questSelection = QuestManager.UI.questSelectionWindow; Debug.Log(questSelection); questSelection.RegisterListener("OnClose", (CallbackEventData eventData) => { InUse = false; }); questSelection.Show(this.m_Title, this.m_Text, (int result) => { currentUsedWindow.Show(this.m_QuestCollection.FirstOrDefault(x => x.Name == quests[result])); }, quests); } else if (quests.Length == 1) { currentUsedWindow.Show(this.m_QuestCollection.FirstOrDefault(x => x.Name == quests[0])); } return(true); }