Added textures to maps
This commit is contained in:
parent
7d5f24c998
commit
11ca59d8bb
@ -49,9 +49,9 @@
|
||||
<Compile Include="Assets\Standard Assets\Character Controllers\Sources\Scripts\MouseLook.cs" />
|
||||
<Compile Include="Assets\Standard Assets\Environment\Water (Basic)\Scripts\WaterBasic.cs" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -49,9 +49,9 @@
|
||||
<Compile Include="Assets\Standard Assets\Character Controllers\Sources\Scripts\MouseLook.cs" />
|
||||
<Compile Include="Assets\Standard Assets\Environment\Water (Basic)\Scripts\WaterBasic.cs" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -69,9 +69,9 @@
|
||||
<Compile Include="Assets\Scripts\Utils\Texture2DExtensions.cs" />
|
||||
<Compile Include="Assets\Scripts\Utils\XmlHelper.cs" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<Reference Include="Assembly-UnityScript-firstpass">
|
||||
<HintPath>C:/Users/Tibi/Google Drive/FacultateCY/$ Licenta/Game/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -69,9 +69,9 @@
|
||||
<Compile Include="Assets\Scripts\Utils\Texture2DExtensions.cs" />
|
||||
<Compile Include="Assets\Scripts\Utils\XmlHelper.cs" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -51,9 +51,9 @@
|
||||
<Compile Include="Assets\Standard Assets\Character Controllers\Sources\Scripts\FlyCam.js" />
|
||||
<Compile Include="Assets\Standard Assets\Character Controllers\Sources\Scripts\PlatformInputController.js" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -51,9 +51,9 @@
|
||||
<Compile Include="Assets\Standard Assets\Character Controllers\Sources\Scripts\FlyCam.js" />
|
||||
<Compile Include="Assets\Standard Assets\Character Controllers\Sources\Scripts\PlatformInputController.js" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61ae52d5f1b61634dad1bf5f17f2ffbd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
@ -4,4 +4,8 @@
|
||||
<height>100</height>
|
||||
<moisture min=".1" max=".5"/>
|
||||
<vegetationDensity min=".2" max=".5" />
|
||||
<textures>
|
||||
<texture src="grass" expr="0.5" />
|
||||
<texture src="sand" expr="clamp01(1 - (height - waterLevel) / (maxHeight - waterLevel) - 0.4) ^ 4" />
|
||||
</textures>
|
||||
</biome>
|
@ -1,4 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69e9c08fb2f75174182f358acfd9e046
|
||||
timeCreated: 1431182540
|
||||
licenseType: Free
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64548912db7fa384bae6c01a19c19da8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
12
Game/Assets/Data/Biomes/Mountain.xml
Normal file
12
Game/Assets/Data/Biomes/Mountain.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<biome>
|
||||
<name>Mountain</name>
|
||||
<height>500</height>
|
||||
<moisture min=".1" max=".3"/>
|
||||
<vegetationDensity min=".5" max=".9" />
|
||||
<textures>
|
||||
<texture src="mountain" expr="0.2" />
|
||||
<texture src="grass" expr="min(1 / (10 * steepness), (1 - ((height - waterLevel) / (maxHeight - waterLevel)))^14)" />
|
||||
<texture src="snow" expr="2 * ((height - waterLevel) / (maxHeight - waterLevel))^2" />
|
||||
</textures>
|
||||
</biome>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<biome>
|
||||
<name>Mountain</name>
|
||||
<height>500</height>
|
||||
<moisture min=".1" max=".3"/>
|
||||
<vegetationDensity min=".5" max=".9" />
|
||||
</biome>
|
9
Game/Assets/Data/Textures.meta
Normal file
9
Game/Assets/Data/Textures.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ce255ae6044b7e4eaac6a942b48ec66
|
||||
folderAsset: yes
|
||||
timeCreated: 1431161020
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Game/Assets/Data/Textures/grass.png
Normal file
BIN
Game/Assets/Data/Textures/grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 MiB |
55
Game/Assets/Data/Textures/grass.png.meta
Normal file
55
Game/Assets/Data/Textures/grass.png.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7616011a71f5ecf4ba3dc61c1777eff3
|
||||
timeCreated: 1431096962
|
||||
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/mountain.jpg
Normal file
BIN
Game/Assets/Data/Textures/mountain.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 283 KiB |
55
Game/Assets/Data/Textures/mountain.jpg.meta
Normal file
55
Game/Assets/Data/Textures/mountain.jpg.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d43d349f94195ff4186b5494b53be8cf
|
||||
timeCreated: 1431101096
|
||||
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/mountain2.jpg
Normal file
BIN
Game/Assets/Data/Textures/mountain2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 943 KiB |
55
Game/Assets/Data/Textures/mountain2.jpg.meta
Normal file
55
Game/Assets/Data/Textures/mountain2.jpg.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40bc97a10d08115408d75574e1289e2d
|
||||
timeCreated: 1431179198
|
||||
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/red.png
Normal file
BIN
Game/Assets/Data/Textures/red.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 552 B |
55
Game/Assets/Data/Textures/red.png.meta
Normal file
55
Game/Assets/Data/Textures/red.png.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 425e8304741cc4542a0bf9d93787a6d0
|
||||
timeCreated: 1431167524
|
||||
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/sand.jpg
Normal file
BIN
Game/Assets/Data/Textures/sand.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 495 KiB |
55
Game/Assets/Data/Textures/sand.jpg.meta
Normal file
55
Game/Assets/Data/Textures/sand.jpg.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a559bfb4fbd4e07489e7d9d4171f225d
|
||||
timeCreated: 1431182383
|
||||
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/snow.jpg
Normal file
BIN
Game/Assets/Data/Textures/snow.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 141 KiB |
55
Game/Assets/Data/Textures/snow.jpg.meta
Normal file
55
Game/Assets/Data/Textures/snow.jpg.meta
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f326f74eac49c343963c28b73b0339a
|
||||
timeCreated: 1431164378
|
||||
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:
|
Binary file not shown.
@ -39,6 +39,7 @@ namespace TransportGame.Business
|
||||
// Try to deserialize biome
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(Biome));
|
||||
var biome = (Biome)serializer.Deserialize(stream);
|
||||
biome.FileName = file;
|
||||
|
||||
// Add it to biome list
|
||||
biomes.Add(biome);
|
||||
|
12
Game/Assets/Scripts/Generator/RoadGenerator.cs.meta
Normal file
12
Game/Assets/Scripts/Generator/RoadGenerator.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca14a99c3a7bbee468354076f2d6f486
|
||||
timeCreated: 1431067754
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -45,6 +45,13 @@ namespace TransportGame.Model
|
||||
/// Gets or sets an array of textures to use
|
||||
/// </summary>
|
||||
[XmlArray("textures")]
|
||||
[XmlArrayItem("texture")]
|
||||
public Texture[] Textures { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the biome file name
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
}
|
||||
|
12
Game/Assets/Scripts/Model/Texture.cs.meta
Normal file
12
Game/Assets/Scripts/Model/Texture.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c67fd1150208b74a835ab23e76d4024
|
||||
timeCreated: 1431072739
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Game/Assets/Scripts/Storage.meta
Normal file
9
Game/Assets/Scripts/Storage.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aac1e643530b91a4387c8da7db6cc4c5
|
||||
folderAsset: yes
|
||||
timeCreated: 1426153506
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Game/Assets/Scripts/Unity.meta
Normal file
9
Game/Assets/Scripts/Unity.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc0bbd2288d13c34ca0d8a7df18c4ff4
|
||||
folderAsset: yes
|
||||
timeCreated: 1431068859
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
12
Game/Assets/Scripts/Unity/InitializeScript.cs.meta
Normal file
12
Game/Assets/Scripts/Unity/InitializeScript.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6476d0467e3fbd47a0b69d427d68e48
|
||||
timeCreated: 1431068945
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -100
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,10 +1,10 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using TransportGame.Utils;
|
||||
using System.Threading;
|
||||
using System.Linq;
|
||||
using TransportGame.Generator;
|
||||
using TransportGame.Model;
|
||||
using TransportGame.Business;
|
||||
using TransportGame.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
public class TerrainGeneratorScript : MonoBehaviour
|
||||
{
|
||||
@ -13,6 +13,7 @@ public class TerrainGeneratorScript : MonoBehaviour
|
||||
public int TerrainWidth = 1024;
|
||||
public int TerrainHeight = 1024;
|
||||
public GameObject WaterObject;
|
||||
public Texture2D[] Textures;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
@ -61,7 +62,27 @@ public class TerrainGeneratorScript : MonoBehaviour
|
||||
terrainData.SetDetailResolution(1024, 8);
|
||||
terrainData.SetHeights(0, 0, map.Heights);
|
||||
terrainData.name = "Generated Terrain Data";
|
||||
yield return null;
|
||||
yield return null;
|
||||
|
||||
if (map.Biome.Textures != null)
|
||||
{
|
||||
SplatPrototype[] prototypes = new SplatPrototype[map.Biome.Textures.Length];
|
||||
|
||||
for (int i = 0; i < map.Biome.Textures.Length; i++)
|
||||
{
|
||||
Texture2D texture = Textures.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!");
|
||||
|
||||
prototypes[i] = new SplatPrototype();
|
||||
prototypes[i].texture = texture;
|
||||
}
|
||||
|
||||
terrainData.splatPrototypes = prototypes;
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// Create terrain object
|
||||
GameObject terrain = Terrain.CreateTerrainGameObject(terrainData);
|
||||
@ -78,11 +99,71 @@ public class TerrainGeneratorScript : MonoBehaviour
|
||||
MeshFilter waterMesh = WaterObject.GetComponent<MeshFilter>();
|
||||
waterMesh.mesh = GenerateWater();
|
||||
}
|
||||
yield return null;
|
||||
|
||||
// Set up textures
|
||||
|
||||
SetupSplatmaps(terrainData);
|
||||
}
|
||||
|
||||
private void SetupSplatmaps(TerrainData terrainData)
|
||||
{
|
||||
float[, ,] splatData = new float[terrainData.alphamapWidth, terrainData.alphamapHeight, terrainData.alphamapLayers];
|
||||
Expression[] expressions = new Expression[terrainData.alphamapLayers];
|
||||
|
||||
for (int y = 0; y < terrainData.alphamapHeight; y++)
|
||||
for (int x = 0; x < terrainData.alphamapWidth; x++)
|
||||
{
|
||||
float y_01 = (float)y / (float)terrainData.alphamapHeight;
|
||||
float x_01 = (float)x / (float)terrainData.alphamapWidth;
|
||||
|
||||
int ix = Mathf.RoundToInt(x_01 * TerrainWidth);
|
||||
int iy = Mathf.RoundToInt(y_01 * TerrainHeight);
|
||||
|
||||
// Get height
|
||||
float height = map.Heights[ix, iy] * terrainData.size.y;
|
||||
|
||||
// Get steepness
|
||||
int safex = (ix == 0) ? 1 : ix;
|
||||
int safey = (iy == 0) ? 1 : iy;
|
||||
|
||||
float dx = map.Heights[safex - 1, safey] * map.Biome.Height - height;
|
||||
float dy = map.Heights[safex, safey - 1] * map.Biome.Height - height;
|
||||
float steepness = dx * dx + dy * dy;
|
||||
|
||||
|
||||
float[] weights = new float[terrainData.alphamapLayers];
|
||||
float sum = 0;
|
||||
|
||||
// Go through each texture layer
|
||||
for (int t = 0; t < terrainData.alphamapLayers; t++)
|
||||
{
|
||||
// Set up expression
|
||||
if (expressions[t] == null)
|
||||
{
|
||||
expressions[t] = new Expression(map.Biome.Textures[t].Expression);
|
||||
expressions[t].ParseExpression();
|
||||
}
|
||||
|
||||
expressions[t].Variables["height"] = height;
|
||||
expressions[t].Variables["steepness"] = steepness;
|
||||
expressions[t].Variables["maxHeight"] = terrainData.size.y;
|
||||
expressions[t].Variables["waterLevel"] = map.WaterLevel - 1f;
|
||||
|
||||
// Obtain weight
|
||||
weights[t] = expressions[t].Evaluate();
|
||||
sum += weights[t];
|
||||
}
|
||||
|
||||
// Normalize and copy weights
|
||||
for (int t = 0; t < terrainData.alphamapLayers; t++)
|
||||
{
|
||||
splatData[x, y, t] = weights[t] / sum;
|
||||
}
|
||||
}
|
||||
|
||||
terrainData.SetAlphamaps(0, 0, splatData);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
12
Game/Assets/Scripts/Unity/TerrainGeneratorScript.cs.meta
Normal file
12
Game/Assets/Scripts/Unity/TerrainGeneratorScript.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: face2544c49ac4a4b8871b8952f2427a
|
||||
timeCreated: 1431068977
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -4,13 +4,16 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GraphingCalculator
|
||||
namespace TransportGame.Utils
|
||||
{
|
||||
public class Expression
|
||||
{
|
||||
#region Types
|
||||
|
||||
public enum TokenType
|
||||
/// <summary>
|
||||
/// Token types
|
||||
/// </summary>
|
||||
protected enum TokenType
|
||||
{
|
||||
None, Literal, Identifier, Operator, ArgSeparator,
|
||||
LParanthesis, RParanthesis, Function
|
||||
@ -21,9 +24,21 @@ namespace GraphingCalculator
|
||||
/// </summary>
|
||||
protected class Token
|
||||
{
|
||||
/// <summary>
|
||||
/// Token type
|
||||
/// </summary>
|
||||
public TokenType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token text
|
||||
/// </summary>
|
||||
public string Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a token
|
||||
/// </summary>
|
||||
/// <param name="type">Token type</param>
|
||||
/// <param name="text">Token text</param>
|
||||
public Token(TokenType type, string text)
|
||||
{
|
||||
Type = type;
|
||||
@ -33,15 +48,25 @@ namespace GraphingCalculator
|
||||
|
||||
#endregion
|
||||
|
||||
#region Variables, properties
|
||||
|
||||
private string expressionString;
|
||||
private bool parsed = false;
|
||||
|
||||
#region Public properties
|
||||
/// <summary>
|
||||
/// Gets the tokens in order
|
||||
/// </summary>
|
||||
protected List<Token> Tokens { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the postfix expression
|
||||
/// </summary>
|
||||
protected List<Token> Postfix { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of variables
|
||||
/// </summary>
|
||||
public Dictionary<string, float> Variables { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the expression string
|
||||
/// </summary>
|
||||
public string ExpressionString
|
||||
{
|
||||
get { return expressionString; }
|
||||
@ -51,18 +76,21 @@ namespace GraphingCalculator
|
||||
parsed = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other stuff
|
||||
#region Private fields
|
||||
|
||||
public void AddVariable(string name, float value)
|
||||
{
|
||||
Variables.Add(name, value);
|
||||
}
|
||||
private string expressionString;
|
||||
private bool parsed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this instance of expression
|
||||
/// </summary>
|
||||
public Expression()
|
||||
{
|
||||
Tokens = new List<Token>();
|
||||
@ -72,13 +100,33 @@ namespace GraphingCalculator
|
||||
Variables.Add("pi", Mathf.PI);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this instance of expression
|
||||
/// </summary>
|
||||
/// <param name="expr">Expression text</param>
|
||||
public Expression(string expr)
|
||||
: this()
|
||||
{
|
||||
expressionString = expr;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other stuff
|
||||
|
||||
/// <summary>
|
||||
/// Adds a variable
|
||||
/// </summary>
|
||||
/// <param name="name">Variable name</param>
|
||||
/// <param name="value">Variable value</param>
|
||||
public void AddVariable(string name, float value)
|
||||
{
|
||||
Variables.Add(name, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Parser
|
||||
|
||||
private void AnalyzeLex()
|
||||
@ -205,6 +253,9 @@ namespace GraphingCalculator
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the expression
|
||||
/// </summary>
|
||||
public void ParseExpression()
|
||||
{
|
||||
if (!parsed)
|
||||
@ -217,6 +268,10 @@ namespace GraphingCalculator
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the expression, and parses it if not parsed yet.
|
||||
/// </summary>
|
||||
/// <returns>Result of evaluation</returns>
|
||||
public float Evaluate()
|
||||
{
|
||||
// Parse expression first
|
||||
@ -303,6 +358,7 @@ namespace GraphingCalculator
|
||||
|
||||
return stack.Pop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper routines
|
||||
|
12
Game/Assets/Scripts/Utils/Expression.cs.meta
Normal file
12
Game/Assets/Scripts/Utils/Expression.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9376fb88fdf55af4db8c52c23079dad3
|
||||
timeCreated: 1431078213
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a0f008388cbb3d41966abd6fa4194ff
|
||||
timeCreated: 1431070785
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
|
@ -63,8 +63,8 @@
|
||||
<Compile Include="Assets\Standard Assets\Environment\Water (Basic)\Scripts\WaterBasic.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
</ItemGroup>
|
||||
|
@ -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>
|
||||
@ -94,8 +92,8 @@
|
||||
<Compile Include="Assets\Scripts\Utils\XmlHelper.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Assets\Data\Biomes\Grassland\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain\Mountain.xml" />
|
||||
<None Include="Assets\Data\Biomes\Grassland.xml" />
|
||||
<None Include="Assets\Data\Biomes\Mountain.xml" />
|
||||
<None Include="Assets\Data\Config\tergen.xml" />
|
||||
<None Include="Assets\Standard Assets\Environment\Water (Basic)\Shaders\FXWaterBasic.shader" />
|
||||
</ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user