示例#1
0
        public void RegisterQuest(AbstractQuest quest)
        {
            if (quest is null)
            {
                throw new ArgumentNullException(nameof(quest));
            }

            if (QuestRegister.Contains(quest))
            {
                throw new ArgumentException("Quest Register already contains this quest object.");
            }

            QuestRegister.Add(quest);

            RegisterModified?.Invoke();
        }
示例#2
0
        /// <summary>
        /// Completely deletes the quest. Also removes links to it from dependent quests.
        /// </summary>
        /// <param name="quest"></param>
        public void UnregisterQuest(AbstractQuest quest)
        {
            if (quest is null)
            {
                throw new ArgumentNullException(nameof(quest));
            }

            if (!QuestRegister.Contains(quest))
            {
                throw new ArgumentException("Quest Register does not contain this quest object.");
            }

            foreach (var dependentQuest in GetDependentQuests(quest))
            {
                dependentQuest.RemoveStep(quest);
            }

            QuestRegister.Remove(quest);

            RegisterModified?.Invoke();
        }