Fixed unity terrain generation bug.

This commit is contained in:
2015-03-19 12:34:58 +02:00
parent 8f9f935796
commit 68140b11a7
40 changed files with 326 additions and 245 deletions

View File

@ -1,44 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using TransportGame.Utils;
namespace TransportGame.Model
{
[XmlRoot("biome")]
public class Biome
{
/// <summary>
/// Gets or sets the name of the biome
/// </summary>
[XmlElement("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the height range of the biome.
/// </summary>
/// <remarks>
/// 1 unit = 100 meters.
/// </remarks>
[XmlElement("heightRange")]
public Range HeightRange { get; set; }
/// <summary>
/// Gets or sets the moisture range.
/// </summary>
/// <remarks>
/// Moisture is the amount of water on a map.
/// Value is a probability, should be between 0 and 1.
/// </remarks>
[XmlElement("moisture")]
public Range Moisture { get; set; }
/// <summary>
/// Gets or sets the vegetation density of the biome
/// </summary>
[XmlElement("vegetationDensity")]
public Range VegetationDensity { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using TransportGame.Utils;
namespace TransportGame.Model
{
[XmlRoot("biome")]
public class Biome
{
/// <summary>
/// Gets or sets the name of the biome
/// </summary>
[XmlElement("name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the maximum height of the biome.
/// </summary>
/// <remarks>
/// 1 unit = 100 meters.
/// </remarks>
[XmlElement("height")]
public float Height { get; set; }
/// <summary>
/// Gets or sets the moisture range.
/// </summary>
/// <remarks>
/// Moisture is the amount of water on a map.
/// Value is a probability, should be between 0 and 1.
/// </remarks>
[XmlElement("moisture")]
public Range Moisture { get; set; }
/// <summary>
/// Gets or sets the vegetation density of the biome
/// </summary>
[XmlElement("vegetationDensity")]
public Range VegetationDensity { get; set; }
}
}

View File

@ -140,7 +140,7 @@ namespace TransportGame.Model
/// <returns></returns>
public bool IsWater(int x, int y)
{
return grid[x, y] <= WaterLevel;
return grid[x, y] * Biome.Height <= WaterLevel;
}
}
}