2015-05-22 08:26:29 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using TransportGame.Generator;
|
|
|
|
|
using TransportGame.Model;
|
|
|
|
|
using TransportGame.Utils;
|
|
|
|
|
|
|
|
|
|
namespace TransportGame.Generator
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Complete city generator. Generates everything, from terrain to buildings
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class CityGenerator
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generates a city
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="width">Width</param>
|
|
|
|
|
/// <param name="height">Height</param>
|
|
|
|
|
/// <returns>City</returns>
|
|
|
|
|
public Map Generate(int width, int height)
|
|
|
|
|
{
|
|
|
|
|
Map map;
|
|
|
|
|
|
|
|
|
|
// Generate terrain
|
|
|
|
|
TerrainGenerator terrainGen = new TerrainGenerator();
|
|
|
|
|
map = terrainGen.Generate(width, height);
|
|
|
|
|
|
|
|
|
|
// Generate population map
|
|
|
|
|
PopulationCentersGenerator populationGen = new PopulationCentersGenerator();
|
|
|
|
|
populationGen.Generate(map);
|
|
|
|
|
|
|
|
|
|
// Generate roads
|
2015-05-26 16:36:44 +00:00
|
|
|
|
RoadGenerator roadGenerator = new RoadGenerator();
|
|
|
|
|
roadGenerator.Generate(map);
|
2015-05-22 08:26:29 +00:00
|
|
|
|
|
2015-05-26 16:36:44 +00:00
|
|
|
|
Logger.DumpMap(map, "withroads.map");
|
2015-05-22 08:26:29 +00:00
|
|
|
|
|
|
|
|
|
// Done
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|