public void Initialize(BuildListItemData buildingData) { data = buildingData; label = transform.Find("Label").GetComponent<UILabel>(); dragBehavior = GetComponent<DragDropItem>(); label.text = buildingData.buildingName; this.placementPrefab = buildingData.prefab; dragBehavior.prefab = placementPrefab; }
private void AddBuildable(BuildListItemData buildingData) { GameObject newBuilding = Instantiate(buildingBoxPrefab, Vector3.zero, Quaternion.identity) as GameObject; newBuilding.transform.parent = transform; newBuilding.transform.localPosition = Vector3.zero; newBuilding.transform.localScale = Vector3.one; BuildListItem buildingController = newBuilding.GetComponent<BuildListItem>(); buildingController.enabled = true; buildingController.Initialize(buildingData); buildingCount++; }
public static BuildListItem Spawn(GameObject host, GameObject creator, BuildListItemData buildingData) { host.transform.parent = creator.transform; host.transform.localPosition = Vector3.zero; host.transform.localScale = Vector3.one; BuildListItem buildingController = host.GetComponent<BuildListItem>(); buildingController.buildList = creator.GetComponent<ColonyBuildList>(); buildingController.Initialize(buildingData); buildingController.enabled = true; return buildingController; }
private void AddBuildable(BuildListItemData buildingData) { GameObject newBuilding = Instantiate(buildingBoxPrefab, Vector3.zero, Quaternion.identity) as GameObject; BuildListItem.Spawn(newBuilding, gameObject, buildingData); buildingCount++; }
private void RestoreOneItem(BuildListItemData item) { AddBuildable(item); structuresTable.Reposition(); }
public void Initialize(BuildListItemData buildingData) { data = buildingData; label.text = buildingData.buildingName; }