public void RestoreState(object state) { if (m_LatestQuest != null) { return; } (string questName, string questGiverName, int latestStage) = (Tuple <string, string, int>)state; if (string.IsNullOrEmpty(questName)) { return; } m_LatestQuest = QuestSaver.Load(questName); m_QuestGiverName = questGiverName; if (!string.IsNullOrEmpty(m_QuestGiverName)) { GameObject qgGObj = GameObject.Find(m_QuestGiverName); if (qgGObj != null) { m_QuestGiver = qgGObj.GetComponent <QuestGiver>(); } } m_LatestQuest.Init(); m_LatestStage = m_LatestQuest.Stages[latestStage]; AttachEvents(); questHUD.UpdateQuestDisplay(m_LatestStage); }
public void AddQuest(QuestGiver qg, Quest quest) { if (qg == null || quest == null) { return; } m_QuestGiverName = qg.name; m_QuestGiver = qg; m_LatestQuest = Instantiate(quest); m_LatestQuest.Init(); AttachEvents(); questHUD.UpdateQuestDisplay(m_LatestStage); }