public Quest GetRootQuest(IQuest reference) { IQuest quest = this.GetQuest(reference.uniqueID); while (!quest.IsQuestRoot()) { quest = this.GetQuest(quest.parent.uniqueID); } return((Quest)quest); }
// PROTECTED METHODS: --------------------------------------------------------------------- protected IQuest GetRootQuest() { IQuest quest = QuestsManager.Instance.GetQuest(this.uniqueID); while (quest != null) { if (quest.IsQuestRoot()) { break; } quest = QuestsManager.Instance.GetQuest(quest.parent.uniqueID); } return(quest); }
private void LoadQuests() { DatabaseQuests database = DatabaseQuests.Load(); this.collection = new Dictionary <string, IQuest>(); this.quests = new Dictionary <string, Quest>(); int questsCount = database.list.Count; for (int i = 0; i < questsCount; ++i) { IQuest reference = database.list[i]; IQuest instance = Instantiate(reference); this.collection.Add(instance.uniqueID, instance); if (instance.IsQuestRoot()) { this.quests.Add(instance.uniqueID, (Quest)instance); } } }