public void CreateText(List <Goal> goals, int money) { moneyText.text = "Bank: $" + money; this.goals = goals; foreach (var goalText in goalTexts) { Destroy(goalText); } goalTexts = new List <GameObject>(); goalTextScripts = new List <GoalTextUI>(); foreach (var goal in goals) { GameObject text = Instantiate(textPrefab); text.transform.parent = this.transform; text.transform.position = new Vector3(0, 0); GoalTextUI goalText = text.GetComponent <GoalTextUI>(); goalText.SetText(goal.GetGoalText(), "Bonus: $" + goal.GetBonus()); goalTexts.Add(text); goalTextScripts.Add(goalText); } hideButton.SetActive(true); nextNightButton.SetActive(false); }
private void Start() { SetupEventListeners(); inProgressQuestContainer.gameObject.SetActive(false); turnedInQuestContainer.gameObject.SetActive(false); questUIprefab = Resources.Load <QuestUI>("UI/QuestUI"); goalTextUIprefab = Resources.Load <GoalTextUI>("UI/GoalText"); inProgressQuestUIList = new List <QuestUI>(); turnedInQuestUIList = new List <QuestUI>(); this.transform.GetChild(0).gameObject.SetActive(isOpen); questDetailContainer.gameObject.SetActive(false); }
private void updateGoalText() { foreach (Transform child in questObjectiveContainer.transform) { Destroy(child.gameObject); } foreach (CollectionGoalTracker goalTracker in selectedQuest.questTracker.goalTrackers) { CollectionGoal goal = (CollectionGoal)goalTracker.goal; GoalTextUI goalText = Instantiate(goalTextUIprefab, questObjectiveContainer); goalText.SetGoalText(goal.itemSlug); goalText.SetProgress(goalTracker.currentAmount + "/" + goal.requiredAmount); } }