public override Dictionary <int, LayerColor> GetLayerColors() { if (this.Parents.Length < 1 || this.Parents[0] == null) { return(null); } else { return(BuildingEngine.GetBuildingBrushes()); } }
protected override int[] GenerateDataImpl(long x, long y, long z, long width, long height, long depth) { if (this.Parents.Length < 1 || this.Parents[0] == null) { return(new int[width * height * depth]); } long ox = this.EdgeSampling; long oy = this.EdgeSampling; long rx = x - this.EdgeSampling; long ry = y - this.EdgeSampling; long rw = width + this.EdgeSampling * 2; long rh = height + this.EdgeSampling * 2; // Just need to add in offsets for x + y, up to 15; int[] citybiomes = this.Parents[0].GenerateData(rx, ry, z, rw, rh, depth); int[] data = new int[width * height * depth]; int[] tempdata = new int[width * height * depth]; // Populate with air for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { data[i + j * width] = -1; } } // Write out the buildings list. for (long i = 0; i < rw; i++) { for (long j = 0; j < rh; j++) { int BuildingID = BuildingEngine.GetBuildingsForCell(citybiomes, ZoomLevel, r, x, y, width, height); if (i + BuildingEngine.Buildings[BuildingID].Length < rw && j + BuildingEngine.Buildings[BuildingID].Width < rh) { for (int k = 0; k < BuildingEngine.Buildings[BuildingID].Length; k++) { for (int l = 0; l < BuildingEngine.Buildings[BuildingID].Width; l++) { data[i + k + (j + l) * width] = BuildingID; } } } } } return(data); }
static BuildingEngine() { BuildingEngine.Buildings = new List <Building>(); foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Type t in a.GetTypes()) { if (typeof(Building).IsAssignableFrom(t) && !t.IsAbstract) { BuildingEngine.Buildings.Add(BuildingEngine.NewBuilding(t)); } } } }