void CompletQuestList() { numberOfCompletQuests = QuestHandler.questHandler.numberOfCompletQuests; if (completQuestHolder.Count > 0) // If a list exit, destroy all the elementes inside to be update. { foreach (GameObject obj in completQuestHolder) { DestroyObject(obj); } completQuestHolder = new List <GameObject> (); } foreach (var quest in QuestHandler.questHandler.completedQuests) { GameObject completQuest = Instantiate(questHolderObj) as GameObject; completQuest.transform.SetParent(this.transform, false); completQuestHolder.Add(completQuest); QuestHolderSetUp completSetup = completQuest.GetComponent <QuestHolderSetUp> (); completSetup.SetupQuestHolder(quest); } }
void ActiveQuest() { GameObject activeQuest = Instantiate(questHolderObj) as GameObject; activeQuest.transform.SetParent(this.transform, false); //false keeps the local orientation rather than the global orientation. QuestHolderSetUp activeSetup = activeQuest.GetComponent <QuestHolderSetUp>(); activeSetup.SetupQuestHolder(QuestHandler.questHandler.activeQuest); }