예제 #1
0
    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;
    }
예제 #2
0
    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++;
    }
예제 #3
0
    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;
    }
예제 #4
0
 private void AddBuildable(BuildListItemData buildingData)
 {
     GameObject newBuilding = Instantiate(buildingBoxPrefab, Vector3.zero, Quaternion.identity) as GameObject;
     BuildListItem.Spawn(newBuilding, gameObject, buildingData);
     buildingCount++;
 }
예제 #5
0
 private void RestoreOneItem(BuildListItemData item)
 {
     AddBuildable(item);
     structuresTable.Reposition();
 }
예제 #6
0
 public void Initialize(BuildListItemData buildingData)
 {
     data = buildingData;
     label.text = buildingData.buildingName;
 }