Added textures to buildings. Other small improvements.
9
Game/Assets/Data/Models.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3617eae5209a57a468456fca3ed65d5c
|
||||
folderAsset: yes
|
||||
timeCreated: 1434233459
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Game/Assets/Data/Textures/Buildings.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c35f5a96a0dd2df44ac2dbc5ea92151c
|
||||
folderAsset: yes
|
||||
timeCreated: 1434231529
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Game/Assets/Data/Textures/Buildings/building0.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
55
Game/Assets/Data/Textures/Buildings/building0.jpg.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 960e9aa3cdf7446499445850778f592f
|
||||
timeCreated: 1434231735
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 0
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Game/Assets/Data/Textures/Buildings/building1.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
55
Game/Assets/Data/Textures/Buildings/building1.jpg.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44bd4459660780445a19dded00f3c244
|
||||
timeCreated: 1434231734
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Game/Assets/Data/Textures/Buildings/building2.jpg
Normal file
After Width: | Height: | Size: 292 KiB |
55
Game/Assets/Data/Textures/Buildings/building2.jpg.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67dfff28f11b6f84aab9ffb599c43452
|
||||
timeCreated: 1434231735
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 512
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Game/Assets/Data/Textures/Terrain.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d317d31a2ece79468ef386567899728
|
||||
folderAsset: yes
|
||||
timeCreated: 1434231519
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Before Width: | Height: | Size: 3.0 MiB After Width: | Height: | Size: 3.0 MiB |
Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 283 KiB |
Before Width: | Height: | Size: 943 KiB After Width: | Height: | Size: 943 KiB |
Before Width: | Height: | Size: 495 KiB After Width: | Height: | Size: 495 KiB |
Before Width: | Height: | Size: 455 KiB After Width: | Height: | Size: 455 KiB |
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
Before Width: | Height: | Size: 356 KiB After Width: | Height: | Size: 356 KiB |
@ -202,7 +202,7 @@ namespace TransportGame.Generator
|
||||
}
|
||||
else
|
||||
{
|
||||
b.LevelHeights[i] = random.NextSingle(ConfigManager.Buildgen.MinBuildingHeight, ConfigManager.Buildgen.MaxBuildingHeight) * map.GetPopulation(lot.Position);
|
||||
b.LevelHeights[i] = ConfigManager.Buildgen.MinLevelHeight + (random.NextSingle() * map.GetPopulation(lot.Position)) * (ConfigManager.Buildgen.MaxLevelHeight - ConfigManager.Buildgen.MinLevelHeight);
|
||||
}
|
||||
|
||||
for (int j = 0; j < random.Next(ConfigManager.Buildgen.MaxPolygonsPerLevel); j++)
|
||||
|
@ -35,8 +35,8 @@ namespace TransportGame.Model.Config
|
||||
/// <summary>
|
||||
/// Maximum height for a building
|
||||
/// </summary>
|
||||
public float MaxBuildingHeight { get; set; }
|
||||
public float MinBuildingHeight { get; set; }
|
||||
public float MaxLevelHeight { get; set; }
|
||||
public float MinLevelHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of primitive polygons to be generated per level
|
||||
@ -49,10 +49,10 @@ namespace TransportGame.Model.Config
|
||||
LotSquareMaxSize = 20f;
|
||||
LotSpacing = 0.1f;
|
||||
MaxLotAttempts = 3;
|
||||
MaxBuildingHeight = 25f;
|
||||
MinBuildingHeight = 5f;
|
||||
MaxLevelHeight = 20f;
|
||||
MinLevelHeight = 5f;
|
||||
MaxBuildingLevels = 7;
|
||||
MaxPolygonsPerLevel = 4;
|
||||
MaxPolygonsPerLevel = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,17 +11,22 @@ namespace TransportGame.Unity
|
||||
public class BuildingMeshGenerator
|
||||
{
|
||||
public Material BuildingMaterial { get; set; }
|
||||
public Texture2D[] Textures { get; set; }
|
||||
|
||||
private GameObject parent = new GameObject("buildings");
|
||||
private Map map;
|
||||
private System.Random random = new System.Random();
|
||||
|
||||
public IEnumerable Generate(Map map)
|
||||
{
|
||||
this.map = map;
|
||||
int i = 0;
|
||||
|
||||
foreach (var building in map.Buildings)
|
||||
{
|
||||
GenerateBuilding(building);
|
||||
|
||||
if (++i % 10 == 0)
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
@ -60,10 +65,10 @@ namespace TransportGame.Unity
|
||||
vertices.Add(new Vector3(pts[k].Y, minY, pts[k].X));
|
||||
vertices.Add(new Vector3(pts[k].Y, maxY, pts[k].X));
|
||||
vertices.Add(new Vector3(pts[j].Y, maxY, pts[j].X));
|
||||
uv.Add(new UnityEngine.Vector2(0, 0));
|
||||
uv.Add(new UnityEngine.Vector2(0, 1));
|
||||
uv.Add(new UnityEngine.Vector2(1, 1));
|
||||
uv.Add(new UnityEngine.Vector2(1, 0));
|
||||
uv.Add(new UnityEngine.Vector2(pts[j].Y + pts[j].X, minY));
|
||||
uv.Add(new UnityEngine.Vector2(pts[k].Y + pts[k].X, minY));
|
||||
uv.Add(new UnityEngine.Vector2(pts[k].Y + pts[k].X, maxY));
|
||||
uv.Add(new UnityEngine.Vector2(pts[j].Y + pts[j].X, maxY));
|
||||
triangles.AddRange(new[] { vIndex, vIndex + 1, vIndex + 2 });
|
||||
triangles.AddRange(new[] { vIndex, vIndex + 2, vIndex + 3 });
|
||||
vIndex = vertices.Count;
|
||||
@ -73,8 +78,8 @@ namespace TransportGame.Unity
|
||||
vertices.Add(new Vector3(pts[j].Y, maxY, pts[j].X));
|
||||
vertices.Add(new Vector3(center.Y, maxY, center.X));
|
||||
uv.Add(new UnityEngine.Vector2(0, 0));
|
||||
uv.Add(new UnityEngine.Vector2(0, 1));
|
||||
uv.Add(new UnityEngine.Vector2(1, 1));
|
||||
uv.Add(new UnityEngine.Vector2(0, 0));
|
||||
uv.Add(new UnityEngine.Vector2(0, 0));
|
||||
triangles.AddRange(new[] { vIndex + 2, vIndex + 1, vIndex + 0 });
|
||||
vIndex = vertices.Count;
|
||||
}
|
||||
@ -97,6 +102,13 @@ namespace TransportGame.Unity
|
||||
|
||||
MeshRenderer meshRenderer = inters.AddComponent<MeshRenderer>();
|
||||
meshRenderer.materials = new[] { BuildingMaterial };
|
||||
|
||||
// Pick random texture
|
||||
if (Textures != null)
|
||||
{
|
||||
int t = random.Next(Textures.Length);
|
||||
meshRenderer.material.mainTexture = Textures[t];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ public class TerrainGeneratorScript : MonoBehaviour
|
||||
public int TerrainWidth = 1024;
|
||||
public int TerrainHeight = 1024;
|
||||
public GameObject WaterObject;
|
||||
public Texture2D[] Textures;
|
||||
public Texture2D[] TerrainTextures;
|
||||
public Texture2D[] BuildingTextures;
|
||||
public Material RoadMaterial;
|
||||
public Material BuildingMaterial;
|
||||
|
||||
@ -73,7 +74,7 @@ public class TerrainGeneratorScript : MonoBehaviour
|
||||
|
||||
for (int i = 0; i < map.Biome.Textures.Length; i++)
|
||||
{
|
||||
Texture2D texture = Textures.FirstOrDefault(tex => tex != null && tex.name == map.Biome.Textures[i].Source);
|
||||
Texture2D texture = TerrainTextures.FirstOrDefault(tex => tex != null && tex.name == map.Biome.Textures[i].Source);
|
||||
|
||||
if (texture == null)
|
||||
throw new Exception("Texture " + map.Biome.Textures[i].Source + " not found!");
|
||||
@ -137,6 +138,7 @@ public class TerrainGeneratorScript : MonoBehaviour
|
||||
|
||||
BuildingMeshGenerator buildingMeshGenerator = new BuildingMeshGenerator();
|
||||
buildingMeshGenerator.BuildingMaterial = BuildingMaterial;
|
||||
buildingMeshGenerator.Textures = BuildingTextures;
|
||||
|
||||
RoadMeshGenerator roadMeshGenerator = new RoadMeshGenerator();
|
||||
roadMeshGenerator.RoadMaterial = RoadMaterial;
|
||||
|
@ -1 +1 @@
|
||||
listen 3921045144 1 1
|
||||
listen 2605474146 1 1
|
@ -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.081 seconds
|
||||
desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0
|
||||
<RI> Initializing input.
|
||||
<RI> Input initialized.
|
||||
@ -62,7 +62,7 @@ InitializeScript:Start() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Ga
|
||||
|
||||
(Filename: C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Assets/Scripts/Utils/Logger.cs Line: 66)
|
||||
|
||||
Picked biome: Grassland
|
||||
Picked biome: Mountain
|
||||
|
||||
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebug.gen.cpp Line: 56)
|
||||
|
||||
@ -71,7 +71,7 @@ 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)
|
||||
<GenerateMap>c__Iterator3:MoveNext() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Unity\TerrainGeneratorScript.cs:108)
|
||||
<GenerateMap>c__Iterator3:MoveNext() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Unity\TerrainGeneratorScript.cs:109)
|
||||
|
||||
(Filename: C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Assets/Scripts/Utils/Logger.cs Line: 66)
|
||||
|
||||
@ -80,7 +80,7 @@ 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)
|
||||
<GenerateMap>c__Iterator3:MoveNext() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Unity\TerrainGeneratorScript.cs:136)
|
||||
<GenerateMap>c__Iterator3:MoveNext() (at C:\Users\Tibi\Google Drive\FacultateCY\$ Licenta\Game\Assets\Scripts\Unity\TerrainGeneratorScript.cs:137)
|
||||
|
||||
(Filename: C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Assets/Scripts/Utils/Logger.cs Line: 66)
|
||||
|
||||
@ -91,8 +91,7 @@ TransportGame.Utils.Logger:Log(Level, String, Object[]) (at C:\Users\Tibi\Google
|
||||
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)
|
||||
<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)
|
||||
|
||||
Waiting for finish
|
||||
|