-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildingMenu.cs
44 lines (38 loc) · 1.1 KB
/
BuildingMenu.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BuildingMenu : MonoBehaviour
{
public GameObject BuildingButton;
public RectTransform Group;
public List<GameObject> buttons;
// Use this for initialization
void Start()
{
foreach (BuildingObject o in GameController.instance.buildingObjects)
{
GameObject button = Instantiate(BuildingButton, Group);
BuildingButton b = button.GetComponent<BuildingButton>();
b.buildingObject = o;
buttons.Add(button);
}
}
// Update is called once per frame
void Update()
{
if (GameController.instance.canBuildingList)
{
if (!transform.GetChild(0).gameObject.activeInHierarchy)
{
transform.GetChild(0).gameObject.SetActive(true);
}
} else
{
if (transform.GetChild(0).gameObject.activeInHierarchy)
{
transform.GetChild(0).gameObject.SetActive(false);
}
}
}
}