private ITile[,] GenerateLiveMap(ITile[,] liveMap) { for (byte x = 0; x < _cityWidth; x++) { for (byte y = 0; y < _cityHeight; y++) { switch ((int)_zoning.Map[x, y]) { //Residential case 0: Home bufferHome = new Home(new Point(x, y)); _homes.Add(bufferHome); LiveMap[x, y] = bufferHome; break; //Work case 1: Office bufferOffice = new Office(new Point(x, y)); _offices.Add(bufferOffice); LiveMap[x, y] = bufferOffice; break; //Road case 2: LiveMap[x, y] = new TwoLaneRoad(new Point(x, y)); break; //Intersection case 3: Intersection bufferIntersection = new Intersection(_traffictCycleTime + rand.Next(-30, 30), true); _intersections.Add(bufferIntersection); LiveMap[x, y] = bufferIntersection; break; case 4: LiveMap[x, y] = new Vacant(new Point(x, y)); break; default: throw new Exception("Zoning Map: Enum exceeds expected values"); } } } return(liveMap); }
private ITile[,] GenerateLiveMap(ITile[,] liveMap) { for (byte x = 0; x < _cityWidth; x++) { for (byte y = 0; y < _cityHeight; y++) { switch ((int)_zoning.Map[x,y]) { //Residential case 0: Home bufferHome = new Home(new Point(x,y)); _homes.Add(bufferHome); LiveMap[x, y] = bufferHome; break; //Work case 1: Office bufferOffice = new Office(new Point(x,y)); _offices.Add(bufferOffice); LiveMap[x, y] = bufferOffice; break; //Road case 2: LiveMap[x,y] = new TwoLaneRoad(new Point(x, y)); break; //Intersection case 3: Intersection bufferIntersection = new Intersection(_traffictCycleTime + rand.Next(-30,30), true); _intersections.Add(bufferIntersection); LiveMap[x, y] = bufferIntersection; break; case 4: LiveMap[x,y] = new Vacant(new Point(x,y)); break; default: throw new Exception("Zoning Map: Enum exceeds expected values"); } } } return liveMap; }