public void SetupSavedBuildings(Building.BuildingData[] buildingsData)
 {
     Debug.Log("SetupSavedBuildings");
     Debug.Log("Buildings Nb: " + buildingsData.Length);
     for (int i = 0; i < buildingsData.Length; i++)
     {
         Building.BuildingData bData = buildingsData[i];
         BuildingManager.instance.BuildBuildingOnSlotAtTier(BuildingManager.instance.GetBuildingTypeByID(bData.buildingTypeID), BuildingSlotManager.instance.GetBuildingSlotByID(bData.buildingSlotID), bData.tier);
     }
 }
Beispiel #2
0
    public Building.BuildingData[] GatherBuildingsData()
    {
        int buildingNb = BuildingManager.instance.buildingList.Count;

        Debug.Log("Saving [" + buildingNb + "] buildings...");

        // BuildingData List
        Building.BuildingData[] buildingsData = new Building.BuildingData[buildingNb];

        for (int i = 0; i < buildingNb; i++)
        {
            Debug.Log("Saving [" + BuildingManager.instance.buildingList[i].GetComponent <Building>().buildingType.name + "]");

            Building.BuildingData bData = new Building.BuildingData(BuildingManager.instance.buildingList[i].GetComponent <Building>());

            buildingsData[i] = bData;
        }

        return(buildingsData);
    }