Ejemplo n.º 1
0
    public void SetButtonsCreateBuilding(Building[] buildings, ViligerController controller)
    {
        for (int i = 0; i < buildings.Length; i++)
        {
            GameObject button       = Instantiate(buttonPrefab, unitsButtonsParent);
            Button     buttonScript = button.GetComponent <Button>();

            BuildingSlot slot = button.AddComponent <BuildingSlot>();

            slot.SetContent(controller, buildings[i], i);
            buttonScript.onClick.AddListener(slot.OnTouch);


            buildingButtons.Add(slot);
        }

        unitsButtonsParent.gameObject.SetActive(true);
    }