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>
|
2015-06-17 09:07:02 +00:00
|
|
|
|
public CityMap Generate(int width, int height)
|
2015-05-22 08:26:29 +00:00
|
|
|
|
{
|
2015-06-17 09:07:02 +00:00
|
|
|
|
CityMap map;
|
2015-05-22 08:26:29 +00:00
|
|
|
|
|
|
|
|
|
// 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-06-10 08:49:43 +00:00
|
|
|
|
// Generate buildings
|
|
|
|
|
BuildingGenerator buildingGenerator = new BuildingGenerator();
|
|
|
|
|
buildingGenerator.Generate(map);
|
|
|
|
|
|
2015-05-22 08:26:29 +00:00
|
|
|
|
// Done
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|