public void UpdateUI(QuestData q) { if (CurrentStage != q.CurrentStage) { foreach (UI_QuestObjective qo in Objectives) { Destroy(qo.gameObject); } Objectives.Clear(); CurrentStage = q.CurrentStage; for (int o = 0; o < Quests.QList[q.ID].Stages[q.CurrentStage].Objectives.Count; o++) { UI_QuestObjective newObjective = Instantiate(ObjPrefab, transform).GetComponent <UI_QuestObjective>(); newObjective.Description.text = Quests.QList[q.ID].Stages[q.CurrentStage].Objectives[o].Task; newObjective.Progress.text = q.ObjectiveProgress[o] + "/" + Quests.QList[q.ID].Stages[q.CurrentStage].Objectives[o].RequiredProgress; Objectives.Add(newObjective); } } else { for (int o = 0; o < Objectives.Count; o++) { Objectives[o].Progress.text = q.ObjectiveProgress[o] + "/" + Quests.QList[q.ID].Stages[q.CurrentStage].Objectives[o].RequiredProgress; } } }
public void CreateUI(QuestData q) { Title.text = Quests.QList[q.ID].Title; QuestID = q.ID; CurrentStage = q.CurrentStage; for (int o = 0; o < Quests.QList[q.ID].Stages[q.CurrentStage].Objectives.Count; o++) { UI_QuestObjective newObjective = Instantiate(ObjPrefab, transform).GetComponent <UI_QuestObjective>(); newObjective.Description.text = Quests.QList[q.ID].Stages[q.CurrentStage].Objectives[o].Task; newObjective.Progress.text = q.ObjectiveProgress[o] + "/" + Quests.QList[q.ID].Stages[q.CurrentStage].Objectives[o].RequiredProgress; Objectives.Add(newObjective); } }