Added lot allocation.

This commit is contained in:
2015-06-03 23:54:22 +03:00
parent f9b20b0226
commit 352f212ae9
28 changed files with 488 additions and 65 deletions

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TransportGame.Model.Config
{
public class BuildingGeneratorConfig
{
/// <summary>
/// Lot size
/// </summary>
public float LotSquareSize { get; set; }
/// <summary>
/// Space between lots
/// </summary>
public float LotSpacing { get; set; }
public BuildingGeneratorConfig()
{
LotSquareSize = 1f;
LotSpacing = 0.1f;
}
}
}

View File

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TransportGame.Model.Config
{
public class RoadGeneratorConfig
{
/// <summary>
/// Gets or sets the default segment length
/// </summary>
public float DefaultSegmentLength { get; set; }
/// <summary>
/// Gets or sets the highway segment length
/// </summary>
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; }
/// <summary>
/// Raises road above actual height of terrain
/// </summary>
public float RaiseOffset { get; set; }
/// <summary>
/// Height of sidewalk
/// </summary>
public float SidewalkHeight { get; set; }
/// <summary>
/// On the sides of the roads, so that we can't see under the road
/// </summary>
public float SideCoverHeight { get; set; }
/// <summary>
/// Initializes configuration with default values
/// </summary>
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;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 541bc5719bdd5fc4c84addebb8208869
timeCreated: 1433340433
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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; }
/// <summary>
/// Initializes with default values
/// </summary>
public TerrainGeneratorConfig()
{
NoiseOctaves = 9;
NoiseNonLinearPower = 2.4f;
WaterNonLinearPower = 1.9f;
ElevationScale = 0.001f;
ErodePoints = 100;
ErodeIterations = 60;
ErodeAmountPercent = 0.1f;
}
}
}