Renamed Map to CityMap

This commit is contained in:
Tiberiu Chibici 2015-06-17 12:07:02 +03:00
parent c40690eb85
commit 670f260a4c
23 changed files with 30 additions and 39 deletions

View File

@ -17,7 +17,7 @@ namespace TransportGame.Generator
private float LotSquareMaxSize { get { return ConfigManager.Buildgen.LotSquareMaxSize; } } private float LotSquareMaxSize { get { return ConfigManager.Buildgen.LotSquareMaxSize; } }
private float LotSpacing { get { return ConfigManager.Buildgen.LotSpacing; } } private float LotSpacing { get { return ConfigManager.Buildgen.LotSpacing; } }
private Map map; private CityMap map;
QuadTree<RoadNode> nodeTree; QuadTree<RoadNode> nodeTree;
QuadTree<BuildingLot> lotTree; QuadTree<BuildingLot> lotTree;
@ -214,7 +214,7 @@ namespace TransportGame.Generator
return b; return b;
} }
public void Generate(Map map) public void Generate(CityMap map)
{ {
this.map = map; this.map = map;
map.Buildings = new List<Building>(); map.Buildings = new List<Building>();

View File

@ -19,9 +19,9 @@ namespace TransportGame.Generator
/// <param name="width">Width</param> /// <param name="width">Width</param>
/// <param name="height">Height</param> /// <param name="height">Height</param>
/// <returns>City</returns> /// <returns>City</returns>
public Map Generate(int width, int height) public CityMap Generate(int width, int height)
{ {
Map map; CityMap map;
// Generate terrain // Generate terrain
TerrainGenerator terrainGen = new TerrainGenerator(); TerrainGenerator terrainGen = new TerrainGenerator();

View File

@ -11,7 +11,7 @@ namespace TransportGame.Generator
{ {
System.Random random = new System.Random(); System.Random random = new System.Random();
public void Generate(Map map) public void Generate(CityMap map)
{ {
// Generate range // Generate range
float mp = (float)(map.Width * map.Height) / (1024 * 1024); // For 4k x 4k range should be around 900 float mp = (float)(map.Width * map.Height) / (1024 * 1024); // For 4k x 4k range should be around 900

View File

@ -49,7 +49,7 @@ namespace TransportGame.Generator
List<RoadGeneratorSegment> queue; List<RoadGeneratorSegment> queue;
System.Random random = new System.Random(); System.Random random = new System.Random();
Map map; CityMap map;
private float HighwaySegmentLength { get { return ConfigManager.Roadgen.HighwaySegmentLength; } } private float HighwaySegmentLength { get { return ConfigManager.Roadgen.HighwaySegmentLength; } }
private float DefaultBranchPopulationTreshold { get { return ConfigManager.Roadgen.DefaultBranchPopulationTreshold; } } private float DefaultBranchPopulationTreshold { get { return ConfigManager.Roadgen.DefaultBranchPopulationTreshold; } }
@ -71,7 +71,7 @@ namespace TransportGame.Generator
{ {
} }
public void Initialize(Map map) public void Initialize(CityMap map)
{ {
this.map = map; this.map = map;
map.RoadNetwork = new RoadNetwork(); map.RoadNetwork = new RoadNetwork();
@ -142,7 +142,7 @@ namespace TransportGame.Generator
return !map.IsInside(p.X, p.Y) || map.IsWater(p.X, p.Y) || map.GetSteepness(p.X, p.Y) > SteepnessLimit; return !map.IsInside(p.X, p.Y) || map.IsWater(p.X, p.Y) || map.GetSteepness(p.X, p.Y) > SteepnessLimit;
} }
public void Generate(Map map) public void Generate(CityMap map)
{ {
Initialize(map); Initialize(map);

View File

@ -34,10 +34,10 @@ namespace TransportGame.Generator
Noise.Scale = ConfigManager.Tergen.ElevationScale; Noise.Scale = ConfigManager.Tergen.ElevationScale;
} }
public Map Generate(int width, int height) public CityMap Generate(int width, int height)
{ {
// Create map // Create map
Map map = new Map(width, height); CityMap map = new CityMap(width, height);
// Pick a random biome // Pick a random biome
map.Biome = PickBiome(); map.Biome = PickBiome();
@ -61,7 +61,7 @@ namespace TransportGame.Generator
return BiomeManager.Biomes.ElementAt(biome); return BiomeManager.Biomes.ElementAt(biome);
} }
private void GenerateElevation(Map map) private void GenerateElevation(CityMap map)
{ {
for (int x = 0; x < map.Width; ++x) for (int x = 0; x < map.Width; ++x)
for (int y = 0; y < map.Height; ++y) for (int y = 0; y < map.Height; ++y)

View File

@ -10,7 +10,7 @@ using UnityEngine;
namespace TransportGame.Model namespace TransportGame.Model
{ {
[XmlRoot("map")] [XmlRoot("map")]
public class Map public class CityMap
{ {
private float[,] heightmap; private float[,] heightmap;
@ -108,7 +108,7 @@ namespace TransportGame.Model
/// <remarks> /// <remarks>
/// Warning: heights array will be null. /// Warning: heights array will be null.
/// </remarks> /// </remarks>
public Map() public CityMap()
{ {
PopulationCenters = new List<Vector2>(); PopulationCenters = new List<Vector2>();
} }
@ -118,7 +118,7 @@ namespace TransportGame.Model
/// </summary> /// </summary>
/// <param name="width">Width</param> /// <param name="width">Width</param>
/// <param name="height">Height</param> /// <param name="height">Height</param>
public Map(int width, int height) public CityMap(int width, int height)
{ {
heightmap = new float[width, height]; heightmap = new float[width, height];
PopulationCenters = new List<Vector2>(); PopulationCenters = new List<Vector2>();

View File

@ -14,10 +14,10 @@ namespace TransportGame.Unity
public Texture2D[] Textures { get; set; } public Texture2D[] Textures { get; set; }
private GameObject parent = new GameObject("buildings"); private GameObject parent = new GameObject("buildings");
private Map map; private CityMap map;
private System.Random random = new System.Random(); private System.Random random = new System.Random();
public IEnumerable Generate(Map map) public IEnumerable Generate(CityMap map)
{ {
this.map = map; this.map = map;
int i = 0; int i = 0;

View File

@ -35,7 +35,7 @@ namespace TransportGame.Unity
#region Private fields #region Private fields
private Map map; private CityMap map;
private Dictionary<int, Vector2[]> segmentTerminal1Limit = new Dictionary<int, Vector2[]>(); private Dictionary<int, Vector2[]> segmentTerminal1Limit = new Dictionary<int, Vector2[]>();
private Dictionary<int, Vector2[]> segmentTerminal2Limit = new Dictionary<int, Vector2[]>(); private Dictionary<int, Vector2[]> segmentTerminal2Limit = new Dictionary<int, Vector2[]>();
@ -47,7 +47,7 @@ namespace TransportGame.Unity
public Material RoadMaterial { get; set; } public Material RoadMaterial { get; set; }
public Material SidewalkMaterial { get; set; } public Material SidewalkMaterial { get; set; }
public IEnumerable Generate(Map map) public IEnumerable Generate(CityMap map)
{ {
this.map = map; this.map = map;

View File

@ -9,7 +9,7 @@ using UnityEngine;
public class TerrainGeneratorScript : MonoBehaviour public class TerrainGeneratorScript : MonoBehaviour
{ {
private Map map = null; private CityMap map = null;
public int TerrainWidth = 1024; public int TerrainWidth = 1024;
public int TerrainHeight = 1024; public int TerrainHeight = 1024;

View File

@ -91,7 +91,7 @@ namespace TransportGame.Utils
Log(Level.Critical, "{0}: {1}\nStack trace:{2}", ex.GetType().ToString(), ex.Message, ex.StackTrace); Log(Level.Critical, "{0}: {1}\nStack trace:{2}", ex.GetType().ToString(), ex.Message, ex.StackTrace);
} }
public static void DumpMap(Map map, string filename) public static void DumpMap(CityMap map, string filename)
{ {
map.SerializeXml(Path.Combine(LogsDirectory, filename)); map.SerializeXml(Path.Combine(LogsDirectory, filename));
} }

View File

@ -23,7 +23,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj StartupItem = Assembly-CSharp.csproj
Policies = $0 Policies = $0
$0.TextStylePolicy = $1 $0.TextStylePolicy = $1

View File

@ -29,7 +29,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj StartupItem = Assembly-CSharp.csproj
Policies = $0 Policies = $0
$0.TextStylePolicy = $1 $0.TextStylePolicy = $1

View File

@ -1 +1 @@
listen 2605474146 1 1 listen 3964677318 1 1

View File

@ -16,7 +16,7 @@ Platform assembly: C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Transpo
Loading C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\TransportGame_Data\Managed\Assembly-UnityScript-firstpass.dll into Unity Child Domain Loading C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\TransportGame_Data\Managed\Assembly-UnityScript-firstpass.dll into Unity Child Domain
Platform assembly: C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\TransportGame_Data\Managed\UnityEngine.UI.dll (this message is harmless) Platform assembly: C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\TransportGame_Data\Managed\UnityEngine.UI.dll (this message is harmless)
Loading C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\TransportGame_Data\Managed\UnityEngine.UI.dll into Unity Child Domain Loading C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\TransportGame_Data\Managed\UnityEngine.UI.dll into Unity Child Domain
- Completed reload, in 0.081 seconds - Completed reload, in 0.045 seconds
desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0 desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0
<RI> Initializing input. <RI> Initializing input.
<RI> Input initialized. <RI> Input initialized.
@ -84,14 +84,3 @@ TransportGame.Utils.Logger:Info(String, Object[]) (at C:\Users\Tibi\Google Drive
(Filename: C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Assets/Scripts/Utils/Logger.cs Line: 66) (Filename: C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Assets/Scripts/Utils/Logger.cs Line: 66)
Finished generating road mesh.
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
TransportGame.Utils.Logger:Log(Level, String, Object[]) (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Utils\Logger.cs:66)
TransportGame.Utils.Logger:Info(String, Object[]) (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Utils\Logger.cs:74)
TransportGame.Unity.<Generate>c__Iterator2:MoveNext() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Unity\RoadMeshGenerator.cs:95)
TransportGame.Utils.<InParallel>c__Iterator8:MoveNext() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Utils\Task.cs:82)
<GenerateMap>c__Iterator3:MoveNext() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Unity\TerrainGeneratorScript.cs:146)
(Filename: C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Assets/Scripts/Utils/Logger.cs Line: 66)

View File

@ -7,14 +7,16 @@
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{02576F1D-BE9C-CFA7-763D-1EBF63B36977}</ProjectGuid> <ProjectGuid>{02576F1D-BE9C-CFA7-763D-1EBF63B36977}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace></RootNamespace> <RootNamespace>
</RootNamespace>
<AssemblyName>Assembly-CSharp</AssemblyName> <AssemblyName>Assembly-CSharp</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier> <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile> <TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile>
<CompilerResponseFile></CompilerResponseFile> <CompilerResponseFile>
</CompilerResponseFile>
<UnityProjectType>Game:1</UnityProjectType> <UnityProjectType>Game:1</UnityProjectType>
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget> <UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget>
<UnityVersion>5.0.1f1</UnityVersion> <UnityVersion>5.0.1f1</UnityVersion>
@ -85,7 +87,7 @@
<Compile Include="Assets\Scripts\Model\Config\TerrainGeneratorConfig.cs" /> <Compile Include="Assets\Scripts\Model\Config\TerrainGeneratorConfig.cs" />
<Compile Include="Assets\Scripts\Model\IPositionable.cs" /> <Compile Include="Assets\Scripts\Model\IPositionable.cs" />
<Compile Include="Assets\Scripts\Model\LineSegment.cs" /> <Compile Include="Assets\Scripts\Model\LineSegment.cs" />
<Compile Include="Assets\Scripts\Model\Map.cs" /> <Compile Include="Assets\Scripts\Model\CityMap.cs" />
<Compile Include="Assets\Scripts\Model\Polygon.cs" /> <Compile Include="Assets\Scripts\Model\Polygon.cs" />
<Compile Include="Assets\Scripts\Model\Range.cs" /> <Compile Include="Assets\Scripts\Model\Range.cs" />
<Compile Include="Assets\Scripts\Model\Rectangle.cs" /> <Compile Include="Assets\Scripts\Model\Rectangle.cs" />