private void UpdateMissionObjectives() { for (int i = 0; i < this.mission.objectives.Length; i++) { ObjectiveUI ui = this.objectiveUIElements[i]; if (this.mission.objectives[i].isComplete) { ui.objectiveComplete.SetActive(true); } else { ui.objectiveComplete.SetActive(false); } } if (this.mission.isComplete) { this.missionComplete.SetActive(true); // Then update ingamecontroller with mission completion. } else { this.missionComplete.SetActive(false); } }
public void SetMission(Mission mission) { // Initialize mission info. this.mission = mission; this.missionName.text = mission.name; this.missionDesc.text = mission.desc; // Initialize objectives info. this.objectiveUIElements = new ObjectiveUI[mission.objectives.Length]; for (int i = 0; i < mission.objectives.Length; i++) { // Create new button for char in inventory. GameObject gobj = GameObject.Instantiate(this.objectiveUIPrefab, Vector3.zero, Quaternion.identity) as GameObject; gobj.transform.SetParent(this.objectivesParent); // Setup position and scale of button. RectTransform rt = gobj.GetComponent <RectTransform>(); rt.offsetMin = new Vector2(0.0f, rt.offsetMin.y); rt.offsetMax = new Vector2(0.0f, rt.offsetMax.y); rt.anchoredPosition = new Vector2(0.0f, i * -40.0f); rt.localScale = Vector3.one; // Populate the objective with info. ObjectiveUI ui = gobj.GetComponent <ObjectiveUI>(); if (ui != null) { A_Objective objective = mission.objectives[i]; ui.objectiveName.text = objective.name; ui.objectiveDesc.text = objective.desc; } this.objectiveUIElements[i] = ui; } this.UpdateMissionObjectives(); }
private void GenerateObjectiveUI(QuestState questState) { int diff = questState.ObjectiveStates.Count - _objectives.Count; for (int i = 0; i < diff; i++) { ObjectiveUI objectiveUI = Instantiate(_questObjectivePrefab, _objectivesParent); _objectives.Add(objectiveUI); } }
void CreateObjective(Task task) { Checklist checklist = SimulationAttempt.Checklist; GameObject obj = Instantiate(_objectivePrefab, transform); ObjectiveUI objectiveUI = obj.GetComponent <ObjectiveUI>(); if (objectiveUI != null) { objectiveUI.SetText(task.description); objectiveUI.SetToggle(task.completed); objectiveUI.SubscribeToTaskChange(checklist, task); } }
public new void Initialize(LocationData data) { foreach (var item in data.prefabCharacterPositionList) { Structure structure = MapManager.Instance.CreateObject(item.prefab, item.position) as Structure; objectList.Add(structure); if (structure.data.isObjective) { objectivesList.Add(structure); if (objectivesPanel != null) { GameObject objUi = Instantiate(MapManager.Instance.generalData.objectiveUI, objectivesPanel.transform); ObjectiveUI ui = objUi.GetComponent <ObjectiveUI>(); ui.Initialize(structure.data.objectiveText, structure); objectivesUiList.Add(ui); } } } startDist = data.StartDist; }
private void Awake() { instance = this; text = transform.Find("Text").GetComponent <Text>(); }