コード例 #1
0
    private static void FindLotsInBlueprint(SettlementPrefab prefab)
    {
        var blueprint = prefab.Blueprint;

        for (var currentRow = 0; currentRow < NumRows; currentRow++)
        {
            for (var currentColumn = 0; currentColumn < NumColumns; currentColumn++)
            {
                if (blueprint[currentRow, currentColumn] != LotKey)
                {
                    continue;
                }

                if (prefab.Lots.Count == 0)
                {
                    var lot = GetNewLotInfo(new Vector2(currentRow, currentColumn), blueprint);
                    prefab.Lots.Add(lot);
                }
                else
                {
                    if (IsPartOfExistingLot(new Vector2(currentRow, currentColumn), prefab.Lots))
                    {
                        continue;
                    }

                    var lot = GetNewLotInfo(new Vector2(currentRow, currentColumn), blueprint);
                    prefab.Lots.Add(lot);
                }
            }
        }
    }
コード例 #2
0
 public static void AssignBuildingToLots(SettlementPrefab prefab)
 {
     foreach (var lot in prefab.Lots)
     {
         var buildingPrefab = BuildingPrefabStore.GetBuildingPrefabForLot(lot);
         lot.AssignedBuilding = new Building(buildingPrefab);
     }
 }
コード例 #3
0
    public static void AssignBuildingToStartingArea(SettlementPrefab prefab)
    {
        var lot = prefab.Lots[Random.Range(0, prefab.Lots.Count)];

        var building = BuildingPrefabStore.GetBuildingPrefab("starting_building_1");

        lot.AssignedBuilding = new Building(building, true);
    }
コード例 #4
0
 public SettlementPrefab(SettlementPrefab prefab)
 {
     Blueprint = prefab.Blueprint;
     Lots      = new List <Lot>(prefab.Lots);
 }