public static void AddActiveQuest(string questName) { if (ActiveQuests.Contains(questName)) { Debug.Log("Quest name has to be unique"); return; } ActiveQuests.Add(questName); }
/// <summary>Called when a quest's active state has changed to add it to or remove it from the activeQuests list</summary> private void OnActiveStateChanged(Quest quest, bool value) { if (value) { ActiveQuests.Add(quest); MainCanvasManager.Instance.AddNotification(GameNotificationType.Quest); } else { ActiveQuests.Remove(quest); } }
public static bool ActivateQuest(Quest quest) { if (quest.IsActive) { return(false); } if (ActiveQuests.Count >= MAX_QUESTS_ACTIVE) { // cannot activate quest. return(false); } // set to active. quest.IsActive = true; ActiveQuests.Add(quest); OnQuestActivate?.Invoke(quest); return(true); }
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 }