Exemplo n.º 1
0
    public static void AddActiveQuest(string questName)
    {
        if (ActiveQuests.Contains(questName))
        {
            Debug.Log("Quest name has to be unique");
            return;
        }

        ActiveQuests.Add(questName);
    }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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
        }