public static void AddActiveQuest(string questName) { if (ActiveQuests.Contains(questName)) { Debug.Log("Quest name has to be unique"); return; } ActiveQuests.Add(questName); }
public static void DeactivateQuest(Quest quest) { if (!quest.IsActive) { return; } if (!ActiveQuests.Contains(quest)) { return; } ActiveQuests.Remove(quest); OnQuestDeactivate?.Invoke(quest); quest.ResetAllProgress(); // set to not active. quest.IsActive = false; }
private void Start() { foreach (Quest quest in questAsset.Quests) { quest.LoadActiveStateFromFile(); quest.LoadTasksFromFile(); quest.ActiveStateChanged += OnActiveStateChanged; quest.Completed += OnQuestCompleted; } #if UNITY_EDITOR //quest state is saved in editor so add active quests manually if in editor foreach (Quest quest in questAsset.Quests) { if (quest.IsActive && !ActiveQuests.Contains(quest)) { ActiveQuests.Add(quest); } } #endif }