private void PlaceBuildings(CityMap city, int count) { if (count == 0) { return; } var roadNetwork = FindRoadNetwork(city); var openPositions = FindOpenPositions(roadNetwork, city); for (var i = 0; i < count; i++) { if (!openPositions.Any()) { return; } // TODO: Maybe multiple positions should be evaluated and the best be chosen. Experiment with it. var id = _rnd.Next(openPositions.Count); var pos = openPositions[id]; // TODO: This should be buildings chosen by the actor, not the zone. city.PlaceBuilding(pos, _zone.GetRandom(_rnd)); openPositions.RemoveAt(id); } }
public void Apply(int x, int y) { // This needs to be changed as I don't want buildings to be used for roads. _city.PlaceBuilding(new Point(x, y), _zone.GetRandom(_rnd)); _city.Terrain[x, y].ZoneId = _zone.Id; }