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 object CaptureState() { if (m_LatestQuest == null) { return(new Tuple <string, string, int>(null, null, 0)); } // fix scene prefab overrides! QuestSaver.Save(m_LatestQuest); return(new Tuple <string, string, int>(m_LatestQuest.ID, m_QuestGiverName, m_LatestQuest.Stages.IndexOf(m_LatestStage))); }