예제 #1
0
    private void ShowPeople()
    {
        gameObject.SetActive(true);
        GameObject newItem = null;

        GameObject people = GameObject.Find("People");
        print(people.transform.childCount);
        for (int i = 0; i < people.transform.childCount; i++)
        {
            PersonController child = people.transform.GetChild(i).GetComponent<PersonController>();
            if (child == null)
                print("oops");
            newItem = Instantiate(listItemPrefab);
            ListItemBehavior controller = newItem.GetComponent<ListItemBehavior>();
            controller.icon = child.icon;
            controller.text = child.PersonTask() + "\n" + child.PersonState();
            controller.SetObject(people.transform.GetChild(i).gameObject, "Person");
            newItem.transform.SetParent(contentPanel.transform, false);
            newItem.transform.localScale = Vector3.one;

        }

    }
예제 #2
0
    private void ShowBuildings()
    {
        gameObject.SetActive(true);
        GameObject newItem = null;

        GameObject buildings = GameObject.Find("Buildings");
        print(buildings.transform.childCount);
        for (int i = 0; i < buildings.transform.childCount; i++)
        {
            ObjectController child = buildings.transform.GetChild(i).GetComponent<ObjectController>();
            if (child == null)
                print("oops");
            newItem = Instantiate(listItemPrefab);
            ListItemBehavior controller = newItem.GetComponent<ListItemBehavior>();
            controller.icon = child.icon;
            controller.text = child.name;
            controller.SetObject(buildings.transform.GetChild(i).gameObject, "Building");
            newItem.transform.SetParent( contentPanel.transform, false);
            newItem.transform.localScale = Vector3.one;

        }
       
    }