diff --git a/Game/Assembly-CSharp-firstpass-vs.csproj b/Game/Assembly-CSharp-firstpass-vs.csproj index 21d4c8f..eb2e979 100644 --- a/Game/Assembly-CSharp-firstpass-vs.csproj +++ b/Game/Assembly-CSharp-firstpass-vs.csproj @@ -48,6 +48,7 @@ + diff --git a/Game/Assembly-CSharp-firstpass.csproj b/Game/Assembly-CSharp-firstpass.csproj index 21d4c8f..eb2e979 100644 --- a/Game/Assembly-CSharp-firstpass.csproj +++ b/Game/Assembly-CSharp-firstpass.csproj @@ -48,6 +48,7 @@ + diff --git a/Game/Assembly-CSharp-vs.csproj b/Game/Assembly-CSharp-vs.csproj index d26af97..b0fee09 100644 --- a/Game/Assembly-CSharp-vs.csproj +++ b/Game/Assembly-CSharp-vs.csproj @@ -47,12 +47,14 @@ - + + + @@ -79,6 +81,7 @@ + diff --git a/Game/Assembly-CSharp.csproj b/Game/Assembly-CSharp.csproj index f175971..0973862 100644 --- a/Game/Assembly-CSharp.csproj +++ b/Game/Assembly-CSharp.csproj @@ -47,12 +47,14 @@ - + + + @@ -79,6 +81,7 @@ + diff --git a/Game/Assembly-UnityScript-firstpass-vs.unityproj b/Game/Assembly-UnityScript-firstpass-vs.unityproj index 06ace76..5a44855 100644 --- a/Game/Assembly-UnityScript-firstpass-vs.unityproj +++ b/Game/Assembly-UnityScript-firstpass-vs.unityproj @@ -50,6 +50,7 @@ + diff --git a/Game/Assembly-UnityScript-firstpass.unityproj b/Game/Assembly-UnityScript-firstpass.unityproj index 06ace76..5a44855 100644 --- a/Game/Assembly-UnityScript-firstpass.unityproj +++ b/Game/Assembly-UnityScript-firstpass.unityproj @@ -50,6 +50,7 @@ + diff --git a/Game/Assets/Data/Config/roadgen.xml b/Game/Assets/Data/Config/roadgen.xml new file mode 100644 index 0000000..318ec5c --- /dev/null +++ b/Game/Assets/Data/Config/roadgen.xml @@ -0,0 +1,23 @@ + + + 24 + 60 + 0.2 + 0.12 + 0.01 + 0.4 + 3 + 10 + 0.448798954 + 0.7853982 + 12 + 19 + 45 + 12 + 5 + 0.8 + 1 + 0.8 + 0.1 + 0.1 + \ No newline at end of file diff --git a/Game/Assets/Data/Config/roadgen.xml.meta b/Game/Assets/Data/Config/roadgen.xml.meta new file mode 100644 index 0000000..b9800e4 --- /dev/null +++ b/Game/Assets/Data/Config/roadgen.xml.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8b97fa810c6224244a5ec1c8d5b27493 +timeCreated: 1433342482 +licenseType: Free +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Game/Assets/Scripts/Business/BiomeManager.cs b/Game/Assets/Scripts/Business/BiomeManager.cs index 81d07fd..910f317 100644 --- a/Game/Assets/Scripts/Business/BiomeManager.cs +++ b/Game/Assets/Scripts/Business/BiomeManager.cs @@ -29,7 +29,7 @@ namespace TransportGame.Business /// public static void LoadBiomes() { - foreach (var file in Directory.GetFiles(ConfigurationManager.BiomeDirectory, "*.xml", SearchOption.AllDirectories)) + foreach (var file in Directory.GetFiles(ConfigManager.BiomeDirectory, "*.xml", SearchOption.AllDirectories)) { try { diff --git a/Game/Assets/Scripts/Business/ConfigManager.cs b/Game/Assets/Scripts/Business/ConfigManager.cs new file mode 100644 index 0000000..0b28b93 --- /dev/null +++ b/Game/Assets/Scripts/Business/ConfigManager.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Xml.Serialization; +using TransportGame.Model.Config; +using TransportGame.Utils; + +namespace TransportGame.Business +{ + public static class ConfigManager + { + public static readonly string BiomeDirectory = "Assets\\Data\\Biomes"; + public static readonly string ConfigurationDirectory = "Assets\\Data\\Config"; + + public static readonly string TerrGenConfigFile = "tergen.xml"; + public static readonly string RoadGenConfigFile = "roadgen.xml"; + + public static TerrainGeneratorConfig Tergen { get; private set; } + public static RoadGeneratorConfig Roadgen { get; private set; } + public static BuildingGeneratorConfig Buildgen { get; private set; } + + public static void LoadConfiguration() + { + // Terrain generator + string tergenPath = Path.Combine(ConfigurationDirectory, TerrGenConfigFile); + if (File.Exists(tergenPath)) + { + Tergen = SerializationHelper.DeserializeXml(Path.Combine(ConfigurationDirectory, TerrGenConfigFile)); + } + else + { + Tergen = new TerrainGeneratorConfig(); + Tergen.SerializeXml(tergenPath); + } + + // Road generator + string roadgenPath = Path.Combine(ConfigurationDirectory, RoadGenConfigFile); + if (File.Exists(roadgenPath)) + { + Roadgen = SerializationHelper.DeserializeXml(Path.Combine(ConfigurationDirectory, RoadGenConfigFile)); + } + else + { + Roadgen = new RoadGeneratorConfig(); + Roadgen.SerializeXml(roadgenPath); + } + + // Building generator + Buildgen = new BuildingGeneratorConfig(); + } + } +} + diff --git a/Game/Assets/Scripts/Business/ConfigurationManager.cs.meta b/Game/Assets/Scripts/Business/ConfigManager.cs.meta similarity index 100% rename from Game/Assets/Scripts/Business/ConfigurationManager.cs.meta rename to Game/Assets/Scripts/Business/ConfigManager.cs.meta diff --git a/Game/Assets/Scripts/Business/ConfigurationManager.cs b/Game/Assets/Scripts/Business/ConfigurationManager.cs deleted file mode 100644 index 81a3f9d..0000000 --- a/Game/Assets/Scripts/Business/ConfigurationManager.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Xml.Serialization; -using Assets.Scripts.Model.Config; -using TransportGame.Utils; - -namespace TransportGame.Business -{ - public static class ConfigurationManager - { - public static readonly string BiomeDirectory = "Assets\\Data\\Biomes"; - public static readonly string ConfigurationDirectory = "Assets\\Data\\Config"; - - public static readonly string TerrGenConfigFile = "tergen.xml"; - - public static TerrainGeneratorConfig TerrGenConfig { get; private set; } - - public static void LoadConfiguration() - { - // Load terrgen config - TerrGenConfig = SerializationHelper.DeserializeXml(Path.Combine(ConfigurationDirectory, TerrGenConfigFile)); - } - } -} diff --git a/Game/Assets/Scripts/Generator/BuildingGenerator.cs b/Game/Assets/Scripts/Generator/BuildingGenerator.cs new file mode 100644 index 0000000..8a9a012 --- /dev/null +++ b/Game/Assets/Scripts/Generator/BuildingGenerator.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TransportGame.Business; +using TransportGame.Model; +using TransportGame.Model.Road; +using TransportGame.Utils; + +namespace TransportGame.Generator +{ + public class BuildingGenerator + { + private const float LotSquareSize = 1f; + private const float LotSpacing = 0.1f; + + private Map map; + QuadTree nodeTree; + QuadTree lotTree; + + private void AllocateLots() + { + float advance = LotSquareSize + LotSpacing; + + // Generate lots for every segment + foreach (var pair in map.RoadNetwork.ArticulationSegments) + { + var seg = pair.Value; + var dir = seg.Direction; + var perp = dir.RotateDeg(90); + + float width0 = ConfigManager.Roadgen.SidewalkWidth + ConfigManager.Roadgen.LaneWidth * seg.LanesTo1; + float width1 = ConfigManager.Roadgen.SidewalkWidth + ConfigManager.Roadgen.LaneWidth * seg.LanesTo2; + + for (Vector2 pos = seg.Terminal1.Position; (pos - seg.Terminal2.Position).LengthSq > advance * advance; pos += dir * advance) + { + // Build lot squares + Vector2[] left = new Vector2[4]; + left[0] = pos + perp * (width0 + LotSpacing + LotSquareSize); + left[1] = pos + perp * (width0 + LotSpacing); + left[2] = pos + dir * LotSquareSize + perp * (width0 + LotSpacing); + left[3] = pos + dir * LotSquareSize + perp * (width0 + LotSpacing + LotSquareSize); + + Vector2[] right = new Vector2[4]; + right[0] = pos - perp * (width0 + LotSpacing + LotSquareSize); + right[1] = pos - perp * (width0 + LotSpacing); + right[2] = pos + dir * LotSquareSize - perp * (width0 + LotSpacing); + right[3] = pos + dir * LotSquareSize - perp * (width0 + LotSpacing + LotSquareSize); + + BuildingLot lot0 = new BuildingLot(left); + BuildingLot lot1 = new BuildingLot(right); + + // Test for intersections + if (CanAllocate(pos, lot0)) + lotTree.Add(lot0); + + if (CanAllocate(pos, lot1)) + lotTree.Add(lot1); + } + } + + // Done + map.BuildingLots = lotTree.ToList(); + } + + private bool CanAllocate(Vector2 pos, BuildingLot lot0) + { + // Test other lots + Rectangle lotArea = new Rectangle(pos.X - 2 * LotSquareSize, pos.Y - 2 * LotSquareSize, pos.X + 2 * LotSquareSize, pos.Y + 2 * LotSquareSize); + foreach (var lot in lotTree.Query(lotArea)) + { + if (BuildingLot.Intersect(lot0, lot)) + return false; + } + + // Test nearby roads + Rectangle roadArea = new Rectangle( + pos.X - 2 * ConfigManager.Roadgen.HighwaySegmentLength, + pos.Y - 2 * ConfigManager.Roadgen.HighwaySegmentLength, + pos.X + 2 * ConfigManager.Roadgen.HighwaySegmentLength, + pos.Y + 2 * ConfigManager.Roadgen.HighwaySegmentLength); + + foreach (var node in nodeTree.Query(roadArea)) + { + foreach (var segment in node.ArticulationSegments) + { + if (BuildingLot.Intersect(lot0, segment.AsLineSegment())) + return false; + } + + } + + return true; + } + + private void GenerateBuildings() + { + + } + + public void Generate(Map map) + { + this.map = map; + + // Construct node tree + nodeTree = new QuadTree(0, 0, map.Width, map.Height); + foreach (var pair in map.RoadNetwork.Nodes) + nodeTree.Add(pair.Value); + + lotTree = new QuadTree(0, 0, map.Width, map.Height); + + // Allocate lots + AllocateLots(); + + GenerateBuildings(); + } + } +} diff --git a/Game/Assets/Scripts/Generator/BuildingGenerator.cs.meta b/Game/Assets/Scripts/Generator/BuildingGenerator.cs.meta new file mode 100644 index 0000000..5677e40 --- /dev/null +++ b/Game/Assets/Scripts/Generator/BuildingGenerator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 387d471e5e9dff54b9cb832e01b969ec +timeCreated: 1433340433 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Game/Assets/Scripts/Generator/RoadGenerator.cs b/Game/Assets/Scripts/Generator/RoadGenerator.cs index 6826cef..bef9e76 100644 --- a/Game/Assets/Scripts/Generator/RoadGenerator.cs +++ b/Game/Assets/Scripts/Generator/RoadGenerator.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using TransportGame.Business; using TransportGame.Model; using TransportGame.Model.Road; using TransportGame.Utils; @@ -50,21 +51,21 @@ namespace TransportGame.Generator System.Random random = new System.Random(); Map map; - const float HighwaySegmentLength = 60; - const float DefaultBranchPopulationTreshold = 0.12f; - const float DefaultBranchProbability = 0.2f; - const float DefaultSegmentLength = 24; - const float SteepnessLimit = 10; - const float SlopeLimit = (float)Math.PI / 7; - const float RoadSegmentAngleLimit = (float)Math.PI / 4; - const float RoadSnapDistance = 19; - const float MinNodeDistance = 12; - const int MaximumRandomStraightAngle = 45; // in degrees - const int MaximumBranchAngleVariation = 12; // in degrees - const float HighwayBranchPopulationTreshold = .4f; // 0..1 - const float HighwayBranchProbability = .01f; - const int HighwayBranchDelay = 3; - const int MaximumIntersectingRoads = 5; + private float HighwaySegmentLength { get { return ConfigManager.Roadgen.HighwaySegmentLength; } } + private float DefaultBranchPopulationTreshold { get { return ConfigManager.Roadgen.DefaultBranchPopulationTreshold; } } + private float DefaultBranchProbability { get { return ConfigManager.Roadgen.DefaultBranchProbability; } } + private float DefaultSegmentLength { get { return ConfigManager.Roadgen.DefaultSegmentLength; } } + private float SteepnessLimit { get { return ConfigManager.Roadgen.SteepnessLimit; } } + private float SlopeLimit { get { return ConfigManager.Roadgen.SlopeLimit; } } + private float RoadSegmentAngleLimit { get { return ConfigManager.Roadgen.RoadSegmentAngleLimit; } } + private float RoadSnapDistance { get { return ConfigManager.Roadgen.RoadSnapDistance; } } + private float MinNodeDistance { get { return ConfigManager.Roadgen.MinNodeDistance; } } + private int MaximumRandomStraightAngle { get { return ConfigManager.Roadgen.MaximumRandomStraightAngle; } } + private int MaximumBranchAngleVariation { get { return ConfigManager.Roadgen.MaximumBranchAngleVariation; } } + private float HighwayBranchPopulationTreshold { get { return ConfigManager.Roadgen.HighwayBranchPopulationTreshold; } } + private float HighwayBranchProbability { get { return ConfigManager.Roadgen.HighwayBranchProbability; } } + private int HighwayBranchDelay { get { return ConfigManager.Roadgen.HighwayBranchDelay; } } + private int MaximumIntersectingRoads { get { return ConfigManager.Roadgen.MaximumIntersectingRoads; } } public RoadGenerator() { @@ -258,7 +259,7 @@ namespace TransportGame.Generator } // Filter & sort the segments by distance - segmentIds = segmentIds.Distinct().OrderBy(id => + segmentIds = segmentIds.Distinct().OrderBy(id => LineSegment.Distance(map.RoadNetwork.ArticulationSegments[id].AsLineSegment(), segment.Terminal2Pos)); foreach (var segmentId in segmentIds) diff --git a/Game/Assets/Scripts/Generator/TerrainGenerator.cs b/Game/Assets/Scripts/Generator/TerrainGenerator.cs index 9ca0286..f3fac12 100644 --- a/Game/Assets/Scripts/Generator/TerrainGenerator.cs +++ b/Game/Assets/Scripts/Generator/TerrainGenerator.cs @@ -26,12 +26,12 @@ namespace TransportGame.Generator { Noise = new PerlinNoiseGenerator(); - if (ConfigurationManager.TerrGenConfig == null) + if (ConfigManager.Tergen == null) throw new Exception("Not initialized!"); - Noise.Octaves = ConfigurationManager.TerrGenConfig.NoiseOctaves; - Noise.NonLinearPower = ConfigurationManager.TerrGenConfig.NoiseNonLinearPower; - Noise.Scale = ConfigurationManager.TerrGenConfig.ElevationScale; + Noise.Octaves = ConfigManager.Tergen.NoiseOctaves; + Noise.NonLinearPower = ConfigManager.Tergen.NoiseNonLinearPower; + Noise.Scale = ConfigManager.Tergen.ElevationScale; } public Map Generate(int width, int height) @@ -48,7 +48,7 @@ namespace TransportGame.Generator // Generate water level float waterAmount = random.NextSingle(map.Biome.Moisture.Minimum, map.Biome.Moisture.Maximum); - map.WaterLevel = Mathf.Pow(waterAmount, ConfigurationManager.TerrGenConfig.WaterNonLinearPower) * map.Biome.Height; + map.WaterLevel = Mathf.Pow(waterAmount, ConfigManager.Tergen.WaterNonLinearPower) * map.Biome.Height; return map; } diff --git a/Game/Assets/Scripts/Model/BuildingLot.cs b/Game/Assets/Scripts/Model/BuildingLot.cs new file mode 100644 index 0000000..57dd375 --- /dev/null +++ b/Game/Assets/Scripts/Model/BuildingLot.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TransportGame.Business; + +namespace TransportGame.Model +{ + public class BuildingLot : IPositionable + { + /// + /// Gets or sets the list of points + /// + public Vector2[] Points { get; set; } + + public BuildingLot() + { + Points = new Vector2[4]; + } + + public BuildingLot(params Vector2[] points) + { + Points = points; + } + + public BuildingLot(IEnumerable points) + { + Points = points.ToArray(); + } + + public Vector2 Position + { + get { return Points.Aggregate((x, y) => x + y) / Points.Length; } + } + + /// + /// Tests if two building lots intersect + /// + /// First lot + /// Second lot + /// + public static bool Intersect(BuildingLot a, BuildingLot b) + { + return (a.Position - b.Position).LengthSq <= ConfigManager.Buildgen.LotSquareSize + ConfigManager.Buildgen.LotSpacing; + } + + /// + /// Tests if a building lot intersects a line segment (such as a road segment) + /// + /// + /// + /// + public static bool Intersect(BuildingLot a, LineSegment b) + { + for (int i = 0; i < a.Points.Length; i++) + { + int j = (i + 1 >= a.Points.Length) ? 0 : i + 1; + + LineSegment s = new LineSegment(a.Points[i], a.Points[j]); + if (LineSegment.Intersect(s, b).HasValue) + return true; + } + + return false; + } + } +} diff --git a/Game/Assets/Scripts/Model/Config/BuildingGeneratorConfig.cs b/Game/Assets/Scripts/Model/Config/BuildingGeneratorConfig.cs new file mode 100644 index 0000000..eeb000d --- /dev/null +++ b/Game/Assets/Scripts/Model/Config/BuildingGeneratorConfig.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace TransportGame.Model.Config +{ + public class BuildingGeneratorConfig + { + /// + /// Lot size + /// + public float LotSquareSize { get; set; } + + /// + /// Space between lots + /// + public float LotSpacing { get; set; } + + public BuildingGeneratorConfig() + { + LotSquareSize = 1f; + LotSpacing = 0.1f; + } + } +} diff --git a/Game/Assets/Scripts/Model/Config/RoadGeneratorConfig.cs b/Game/Assets/Scripts/Model/Config/RoadGeneratorConfig.cs new file mode 100644 index 0000000..3e27e8b --- /dev/null +++ b/Game/Assets/Scripts/Model/Config/RoadGeneratorConfig.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace TransportGame.Model.Config +{ + public class RoadGeneratorConfig + { + /// + /// Gets or sets the default segment length + /// + public float DefaultSegmentLength { get; set; } + + /// + /// Gets or sets the highway segment length + /// + public float HighwaySegmentLength { get; set; } + + public float DefaultBranchProbability { get; set; } + public float DefaultBranchPopulationTreshold { get; set; } + public float HighwayBranchProbability { get; set; } + public float HighwayBranchPopulationTreshold { get; set; } + + public int HighwayBranchDelay { get; set; } + + public float SteepnessLimit { get; set; } + public float SlopeLimit { get; set; } + public float RoadSegmentAngleLimit { get; set; } + public float MinNodeDistance { get; set; } + + public float RoadSnapDistance { get; set; } + public int MaximumRandomStraightAngle { get; set; } + public int MaximumBranchAngleVariation { get; set; } + public int MaximumIntersectingRoads { get; set; } + + public float SidewalkWidth { get; set; } + public float LaneWidth { get; set; } + + /// + /// Raises road above actual height of terrain + /// + public float RaiseOffset { get; set; } + + /// + /// Height of sidewalk + /// + public float SidewalkHeight { get; set; } + + /// + /// On the sides of the roads, so that we can't see under the road + /// + public float SideCoverHeight { get; set; } + + /// + /// Initializes configuration with default values + /// + public RoadGeneratorConfig() + { + HighwaySegmentLength = 60; + DefaultBranchPopulationTreshold = 0.12f; + DefaultBranchProbability = 0.2f; + DefaultSegmentLength = 24; + SteepnessLimit = 10; + SlopeLimit = (float)Math.PI / 7; + RoadSegmentAngleLimit = (float)Math.PI / 4; + RoadSnapDistance = 19; + MinNodeDistance = 12; + MaximumRandomStraightAngle = 45; // in degrees + MaximumBranchAngleVariation = 12; // in degrees + HighwayBranchPopulationTreshold = .4f; // 0..1 + HighwayBranchProbability = .01f; + HighwayBranchDelay = 3; + MaximumIntersectingRoads = 5; + + SidewalkWidth = .8f; + LaneWidth = 1f; + RaiseOffset = 0.8f; + SidewalkHeight = 0.1f; + SideCoverHeight = 0.1f; + } + } +} diff --git a/Game/Assets/Scripts/Model/Config/RoadGeneratorConfig.cs.meta b/Game/Assets/Scripts/Model/Config/RoadGeneratorConfig.cs.meta new file mode 100644 index 0000000..28af879 --- /dev/null +++ b/Game/Assets/Scripts/Model/Config/RoadGeneratorConfig.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 541bc5719bdd5fc4c84addebb8208869 +timeCreated: 1433340433 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Game/Assets/Scripts/Model/Config/TerrainGeneratorConfig.cs b/Game/Assets/Scripts/Model/Config/TerrainGeneratorConfig.cs index f6a76e3..46a9747 100644 --- a/Game/Assets/Scripts/Model/Config/TerrainGeneratorConfig.cs +++ b/Game/Assets/Scripts/Model/Config/TerrainGeneratorConfig.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Xml.Serialization; -namespace Assets.Scripts.Model.Config +namespace TransportGame.Model.Config { [XmlRoot("terrgenConfig")] public class TerrainGeneratorConfig @@ -29,5 +29,19 @@ namespace Assets.Scripts.Model.Config [XmlElement("erodeAmountPercent")] public float ErodeAmountPercent { get; set; } + + /// + /// Initializes with default values + /// + public TerrainGeneratorConfig() + { + NoiseOctaves = 9; + NoiseNonLinearPower = 2.4f; + WaterNonLinearPower = 1.9f; + ElevationScale = 0.001f; + ErodePoints = 100; + ErodeIterations = 60; + ErodeAmountPercent = 0.1f; + } } } diff --git a/Game/Assets/Scripts/Model/Map.cs b/Game/Assets/Scripts/Model/Map.cs index 7fa7123..aab7643 100644 --- a/Game/Assets/Scripts/Model/Map.cs +++ b/Game/Assets/Scripts/Model/Map.cs @@ -83,6 +83,12 @@ namespace TransportGame.Model [XmlElement("roadNetwork")] public RoadNetwork RoadNetwork { get; set; } + /// + /// Gets or sets the building lots + /// + [XmlElement("lots")] + public List BuildingLots { get; set; } + #endregion #region Constructors diff --git a/Game/Assets/Scripts/Unity/InitializeScript.cs b/Game/Assets/Scripts/Unity/InitializeScript.cs index 0d0b207..501f547 100644 --- a/Game/Assets/Scripts/Unity/InitializeScript.cs +++ b/Game/Assets/Scripts/Unity/InitializeScript.cs @@ -12,7 +12,7 @@ public class InitializeScript : MonoBehaviour { // Load configuration Logger.Info("Loading configuration..."); - ConfigurationManager.LoadConfiguration(); + ConfigManager.LoadConfiguration(); // Load biomes Logger.Info("Loading biomes..."); diff --git a/Game/Assets/Scripts/Unity/RoadMeshGenerator.cs b/Game/Assets/Scripts/Unity/RoadMeshGenerator.cs index def8ec3..fffa4b7 100644 --- a/Game/Assets/Scripts/Unity/RoadMeshGenerator.cs +++ b/Game/Assets/Scripts/Unity/RoadMeshGenerator.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; +using TransportGame.Business; using TransportGame.Model; using TransportGame.Model.Road; using TransportGame.Utils; @@ -16,13 +17,19 @@ namespace TransportGame.Unity class RoadMeshGenerator { #region Constants - - private const float SidewalkWidth = .8f; - private const float LaneWidth = 1f; - private const float RaiseOffset = 0.8f; // Raises road above actual height of terrain - private const float SidewalkHeight = 0.1f; // Height of sidewalk - private const float SideCoverHeight = 0.1f; // On the sides of the roads, so that we can't see the road from the underside + private float SidewalkWidth { get { return ConfigManager.Roadgen.SidewalkWidth; } } + + private float LaneWidth { get { return ConfigManager.Roadgen.LaneWidth; } } + + // Raises road above actual height of terrain + private float RaiseOffset { get { return ConfigManager.Roadgen.RaiseOffset; } } + + // Height of sidewalk + private float SidewalkHeight { get { return ConfigManager.Roadgen.SidewalkHeight; } } + + // On the sides of the roads, so that we can't see the road from the underside + private float SideCoverHeight { get { return ConfigManager.Roadgen.SideCoverHeight; } } #endregion diff --git a/Game/Game-csharp.sln b/Game/Game-csharp.sln index b14d0ca..afec93c 100644 --- a/Game/Game-csharp.sln +++ b/Game/Game-csharp.sln @@ -23,7 +23,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution + GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Assembly-CSharp.csproj Policies = $0 $0.TextStylePolicy = $1 diff --git a/Game/Game.sln b/Game/Game.sln index df6f52f..d1d583c 100644 --- a/Game/Game.sln +++ b/Game/Game.sln @@ -29,7 +29,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution + GlobalSection(MonoDevelopProperties) = preSolution StartupItem = Assembly-CSharp.csproj Policies = $0 $0.TextStylePolicy = $1 diff --git a/Game/UnityVS.Game.CSharp.Plugins.csproj b/Game/UnityVS.Game.CSharp.Plugins.csproj index 55e87dc..256889e 100644 --- a/Game/UnityVS.Game.CSharp.Plugins.csproj +++ b/Game/UnityVS.Game.CSharp.Plugins.csproj @@ -65,6 +65,7 @@ + diff --git a/Game/UnityVS.Game.CSharp.csproj b/Game/UnityVS.Game.CSharp.csproj index d0b6ec6..0ca21dc 100644 --- a/Game/UnityVS.Game.CSharp.csproj +++ b/Game/UnityVS.Game.CSharp.csproj @@ -7,14 +7,16 @@ 2.0 {02576F1D-BE9C-CFA7-763D-1EBF63B36977} Library - + + Assembly-CSharp 512 {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} .NETFramework v3.5 Unity Subset v3.5 - + + Game:1 StandaloneWindows64:19 5.0.1f1 @@ -69,12 +71,16 @@ - + + + + + @@ -105,8 +111,9 @@ + - + \ No newline at end of file