public RoadGenerator(int maxPoiCount, HeightMap <ushort> heightMap) { _maxPoiCount = maxPoiCount; _heightMap = heightMap; _map = new RgbBitMap(heightMap.Size); _random = new Random(DateTime.Now.Millisecond + (DateTime.Now.Minute << 9)); }
private void GenerateRoadsBetweenPois() { var roadMap = _getCellMap(); _map = new RgbBitMap(roadMap.HeightMap.Size); _poiLocations.Add(roadMap[100, 15]); _poiLocations.Add(roadMap[40, 120]); for (int poiIndex = 0; poiIndex < _poiLocations.Count - 1; poiIndex++) { if (_poiLocations.Count > 2 && poiIndex == _poiLocations.Count - 1) { GenerateRoad(_poiLocations[poiIndex], _poiLocations[0], roadMap); } else { GenerateRoad(_poiLocations[poiIndex], _poiLocations[poiIndex + 1], roadMap); } } }