예제 #1
0
    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);
        }
    }
예제 #2
0
    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();
    }
예제 #3
0
    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);
        }
    }
예제 #4
0
    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);
        }
    }
예제 #5
0
    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;
    }
예제 #6
0
 private void Awake()
 {
     instance = this;
     text     = transform.Find("Text").GetComponent <Text>();
 }