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
 /// <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);
     }
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
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
        }