public Quest AssignQuest(string questName) { if (assignedQuests.Find(quest => quest.questName == questName)) { Debug.Log("Quest already assigned."); return(null); } Quest questToAdd = (Quest)gameObject.AddComponent(System.Type.GetType(questName)); assignedQuests.Add(questToAdd); questDatabase.AddQuest(questToAdd); QuestUIItem questUIClone = Instantiate(questUIItem, questUIParent); questUIClone.Setup(questToAdd); return(questToAdd); }
public Quest AssignQuest(string questName) { foreach (Quest q in assignedQuests) { if (q.questName == questName) { Debug.LogWarning("La quete est déja assigné"); return(null); } } // trouver la quete a partir de son nom Quest questToAdd = (Quest)gameObject.AddComponent(System.Type.GetType(questName)); assignedQuests.Add(questToAdd); questDatabase.AddQuest(questToAdd); //on ajoute un slot de quete dans le menu déroulant QuestUIItem questUI = Instantiate(questUIItem, questUIParent); //on écris les informations de la quete dans ce slot questUI.Setup(questToAdd); return(questToAdd); }
void InstantiateQuestUIItem() { QuestUIItem questUI = Instantiate(questUIItem, questUIParent); questUI.Setup(quest); }