Various improvements
This commit is contained in:
		| @@ -91,9 +91,6 @@ | ||||
|      <None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" /> | ||||
|      <None Include="Assets\Data\Biomes\Grassland.xml" /> | ||||
|      <None Include="Assets\Data\Biomes\Mountain.xml" /> | ||||
|  <Reference Include="Assembly-UnityScript-firstpass"> | ||||
|  <HintPath>C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll</HintPath> | ||||
|  </Reference> | ||||
|  <Reference Include="UnityEngine.UI"> | ||||
|  <HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath> | ||||
|  </Reference> | ||||
| @@ -101,10 +98,6 @@ | ||||
|  <HintPath>C:/Program Files/Unity/Editor/Data/PlaybackEngines/iossupport/UnityEditor.iOS.Extensions.Xcode.dll</HintPath> | ||||
|  </Reference> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="Assembly-CSharp-firstpass-vs.csproj"> | ||||
|       <Project>{D8888F6A-ABE1-C49B-1A38-F65A81021668}</Project>      <Name>Assembly-CSharp-firstpass-vs</Name>    </ProjectReference> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||||
|   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  | ||||
| 	   Other similar extension points exist, see Microsoft.Common.targets. | ||||
|   | ||||
| @@ -98,12 +98,6 @@ | ||||
|  <HintPath>C:/Program Files/Unity/Editor/Data/PlaybackEngines/iossupport/UnityEditor.iOS.Extensions.Xcode.dll</HintPath> | ||||
|  </Reference> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="Assembly-CSharp-firstpass.csproj"> | ||||
|       <Project>{D8888F6A-ABE1-C49B-1A38-F65A81021668}</Project>      <Name>Assembly-CSharp-firstpass</Name>    </ProjectReference> | ||||
|     <ProjectReference Include="Assembly-UnityScript-firstpass.unityproj"> | ||||
|       <Project>{6F824ECF-F2BC-827E-A29D-FB10759A3283}</Project>      <Name>Assembly-UnityScript-firstpass</Name>    </ProjectReference> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||||
|   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  | ||||
| 	   Other similar extension points exist, see Microsoft.Common.targets. | ||||
|   | ||||
| @@ -15,9 +15,9 @@ | ||||
|   <MaximumRandomStraightAngle>45</MaximumRandomStraightAngle> | ||||
|   <MaximumBranchAngleVariation>12</MaximumBranchAngleVariation> | ||||
|   <MaximumIntersectingRoads>5</MaximumIntersectingRoads> | ||||
|   <SidewalkWidth>0.8</SidewalkWidth> | ||||
|   <LaneWidth>1</LaneWidth> | ||||
|   <SidewalkWidth>1</SidewalkWidth> | ||||
|   <LaneWidth>1.3</LaneWidth> | ||||
|   <RaiseOffset>0.8</RaiseOffset> | ||||
|   <SidewalkHeight>0.1</SidewalkHeight> | ||||
|   <SideCoverHeight>0.1</SideCoverHeight> | ||||
|   <SideCoverHeight>0.4</SideCoverHeight> | ||||
| </RoadGeneratorConfig> | ||||
| @@ -1,6 +1,6 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 8b97fa810c6224244a5ec1c8d5b27493 | ||||
| timeCreated: 1433342482 | ||||
| timeCreated: 1433931275 | ||||
| licenseType: Free | ||||
| TextScriptImporter: | ||||
|   userData:  | ||||
|   | ||||
| @@ -144,10 +144,10 @@ namespace TransportGame.Generator | ||||
|  | ||||
|         Polygon GeneratePrimitivePolygon(BuildingLot lot) | ||||
|         { | ||||
|             int sides = random.Next(3, 8);                    // Number of sides | ||||
|             int sides = random.Next(3, 6);                    // Number of sides | ||||
|             float angle = 2 * (float)Math.PI / sides;         // Angle between sides | ||||
|  | ||||
|             float radius = random.NextSingle(lot.Size * 0.25f, lot.Size * 0.75f) / 2;  // Length of a side | ||||
|             float radius = random.NextSingle(lot.Size * 0.15f, lot.Size * 0.4f);  // Length of a side | ||||
|             Vector2 current = lot.Position + new Vector2(random.NextSingle(-lot.Size / 4, lot.Size / 4), random.NextSingle(-lot.Size / 4, lot.Size / 4)); | ||||
|             Vector2 dir = new Vector2(random.NextSingle(), random.NextSingle()).Normalized * radius; | ||||
|  | ||||
| @@ -185,7 +185,7 @@ namespace TransportGame.Generator | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     b.LevelHeights[i] = random.NextSingle(0, ConfigManager.Buildgen.MaxBuildingHeight); | ||||
|                     b.LevelHeights[i] = random.NextSingle(ConfigManager.Buildgen.MinBuildingHeight, ConfigManager.Buildgen.MaxBuildingHeight); | ||||
|                 } | ||||
|  | ||||
|                 for (int j = 0; j < random.Next(ConfigManager.Buildgen.MaxPolygonsPerLevel); j++) | ||||
|   | ||||
| @@ -36,6 +36,7 @@ namespace TransportGame.Model.Config | ||||
|         /// Maximum height for a building | ||||
|         /// </summary> | ||||
|         public float MaxBuildingHeight { get; set; } | ||||
|         public float MinBuildingHeight { get; set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Maximum number of primitive polygons to be generated per level | ||||
| @@ -49,8 +50,9 @@ namespace TransportGame.Model.Config | ||||
|             LotSpacing = 0.1f; | ||||
|             MaxLotAttempts = 3; | ||||
|             MaxBuildingHeight = 20f; | ||||
|             MaxBuildingLevels = 5; | ||||
|             MaxPolygonsPerLevel = 3; | ||||
|             MinBuildingHeight = 4f; | ||||
|             MaxBuildingLevels = 7; | ||||
|             MaxPolygonsPerLevel = 4; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -73,11 +73,11 @@ namespace TransportGame.Model.Config | ||||
|             HighwayBranchDelay = 3; | ||||
|             MaximumIntersectingRoads = 5; | ||||
|  | ||||
|             SidewalkWidth = .8f; | ||||
|             LaneWidth = 1f; | ||||
|             SidewalkWidth = 1f; | ||||
|             LaneWidth = 1.3f; | ||||
|             RaiseOffset = 0.8f; | ||||
|             SidewalkHeight = 0.1f; | ||||
|             SideCoverHeight = 0.1f; | ||||
|             SideCoverHeight = 0.4f; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -132,35 +132,16 @@ public class TerrainGeneratorScript : MonoBehaviour | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // Generate road & building mesh (we run the loops in parallel) | ||||
|         // Generate road & building mesh (we run the loops in parallel), and apply textures | ||||
|         Logger.Info("Generating buildings and roads..."); | ||||
|  | ||||
|         BuildingMeshGenerator buildingMeshGenerator = new BuildingMeshGenerator(); | ||||
|         buildingMeshGenerator.BuildingMaterial = BuildingMaterial; | ||||
|         var it1 = buildingMeshGenerator.Generate(map).GetEnumerator(); | ||||
|  | ||||
|         RoadMeshGenerator roadMeshGenerator = new RoadMeshGenerator(); | ||||
|         roadMeshGenerator.RoadMaterial = RoadMaterial; | ||||
|         var it2 = roadMeshGenerator.Generate(map).GetEnumerator(); | ||||
|  | ||||
|         bool stop; | ||||
|         do | ||||
|         { | ||||
|             stop = true; | ||||
|             if (it1.MoveNext()) | ||||
|             { | ||||
|                 yield return it1.Current; | ||||
|                 stop = false; | ||||
|             } | ||||
|             if (it2.MoveNext()) | ||||
|             { | ||||
|                 yield return it2.Current; | ||||
|                 stop = false; | ||||
|             } | ||||
|         } while (!stop); | ||||
|  | ||||
|         // Finish setting up textures | ||||
|         foreach (var i in EndSetupSplatmaps(terrainData)) | ||||
|         foreach (var i in Task.InParallel(buildingMeshGenerator.Generate(map), roadMeshGenerator.Generate(map), EndSetupSplatmaps(terrainData))) | ||||
|             yield return i; | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -66,5 +66,26 @@ namespace TransportGame.Utils | ||||
|             if (Success.HasValue && !Success.Value) | ||||
|                 throw new Exception("Task failed", thrownException); | ||||
|         } | ||||
|  | ||||
|         public static IEnumerable InParallel(params IEnumerable[] funcs) | ||||
|         { | ||||
|             // Obtain iterators | ||||
|             var iterators = funcs.Select(enumerable => enumerable.GetEnumerator()).ToArray(); | ||||
|  | ||||
|             // Execute a slice of each | ||||
|             bool stop; | ||||
|             do | ||||
|             { | ||||
|                 stop = true; | ||||
|  | ||||
|                 foreach (var it in iterators) | ||||
|                     if (it.MoveNext()) | ||||
|                     { | ||||
|                         yield return it.Current; | ||||
|                         stop = false; | ||||
|                     } | ||||
|  | ||||
|             } while (!stop); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -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 | ||||
| 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 | ||||
| - Completed reload, in  0.045 seconds | ||||
| - Completed reload, in  0.050 seconds | ||||
| desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0 | ||||
| <RI> Initializing input. | ||||
|  | ||||
| @@ -90,7 +90,8 @@ UnityEngine.Debug:Log(Object) | ||||
| 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: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:144) | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -7,16 +7,14 @@ | ||||
|     <SchemaVersion>2.0</SchemaVersion> | ||||
|     <ProjectGuid>{02576F1D-BE9C-CFA7-763D-1EBF63B36977}</ProjectGuid> | ||||
|     <OutputType>Library</OutputType> | ||||
|     <RootNamespace> | ||||
|     </RootNamespace> | ||||
|     <RootNamespace></RootNamespace> | ||||
|     <AssemblyName>Assembly-CSharp</AssemblyName> | ||||
|     <FileAlignment>512</FileAlignment> | ||||
|     <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||||
|     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier> | ||||
|     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||||
|     <TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile> | ||||
|     <CompilerResponseFile> | ||||
|     </CompilerResponseFile> | ||||
|     <CompilerResponseFile></CompilerResponseFile> | ||||
|     <UnityProjectType>Game:1</UnityProjectType> | ||||
|     <UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget> | ||||
|     <UnityVersion>5.0.1f1</UnityVersion> | ||||
| @@ -119,4 +117,4 @@ | ||||
|     <None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(MSBuildExtensionsPath)\SyntaxTree\UnityVS\2013\UnityVS.CSharp.targets" /> | ||||
| </Project> | ||||
| </Project> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user