private Building ConstructBuilding(Transform root, BuildingConfig buildingConfig, bool isBuildingIn) { var floorScheme = BuildingsDatabase.GetRandomFloorScheme(); var segmentSize = new SegmentSize() { Width = floorScheme.segmentWidth, Height = floorScheme.segmentHeight, Depth = floorScheme.segmentDepth }; var building = new Building(ItemsSpawner, segmentSize, buildingConfig) { root = root, isBuildingIn = isBuildingIn }; Vector3 position = root.position; Quaternion rotation = root.rotation; GenerateFloor(ref building, floorScheme, root, position, root.rotation, 0, FloorType.GroundFloor); int index = 1; for (; index <= buildingConfig.buildingFloorsCount; index++) { position += new Vector3(0f, floorScheme.segmentHeight, 0f); GenerateFloor(ref building, floorScheme, root, position, root.rotation, index, FloorType.MiddleFloor); } position += new Vector3(0f, floorScheme.segmentHeight, 0f); var roofScheme = BuildingsDatabase.GetRandomRoofScheme(); GenerateFloor(ref building, roofScheme, root, position, root.rotation, index, FloorType.Roof); return(building); }
public Building(ItemsSpawner itemsSpawner, SegmentSize segmentSize, BuildingConfig config) { Floors = new Dictionary <int, Floor>(); Stairs = new Dictionary <int, DoorPortal>(); //FloorSize = floorSize; this.itemsSpawner = itemsSpawner; SegmentSize = segmentSize; Config = config; }