Implemented eroder.
This commit is contained in:
@ -20,5 +20,14 @@ namespace Assets.Scripts.Model.Config
|
||||
|
||||
[XmlElement("waterNonLinearPower")]
|
||||
public float WaterNonLinearPower { get; set; }
|
||||
|
||||
[XmlElement("erodePoints")]
|
||||
public int ErodePoints { get; set; }
|
||||
|
||||
[XmlElement("erodeIterations")]
|
||||
public int ErodeIterations { get; set; }
|
||||
|
||||
[XmlElement("erodeAmountPercent")]
|
||||
public float ErodeAmountPercent { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace TransportGame.Model
|
||||
public Biome Biome { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the heights array
|
||||
/// Gets the heights array in range [0,1]
|
||||
/// </summary>
|
||||
[XmlIgnore()]
|
||||
public float[,] Heights
|
||||
@ -102,7 +102,7 @@ namespace TransportGame.Model
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the cell at specified position
|
||||
/// Gets or sets the cell at specified position in range [0, Biome.Height]
|
||||
/// </summary>
|
||||
/// <param name="x">X</param>
|
||||
/// <param name="y">Y</param>
|
||||
@ -112,11 +112,11 @@ namespace TransportGame.Model
|
||||
{
|
||||
get
|
||||
{
|
||||
return grid[x, y];
|
||||
return grid[x, y] * Biome.Height;
|
||||
}
|
||||
set
|
||||
{
|
||||
grid[x, y] = value;
|
||||
grid[x, y] = value / Biome.Height;
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,18 @@ namespace TransportGame.Model
|
||||
/// <returns></returns>
|
||||
public bool IsWater(int x, int y)
|
||||
{
|
||||
return grid[x, y] * Biome.Height <= WaterLevel;
|
||||
return this[x, y] <= WaterLevel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if given coordinates is inside the map
|
||||
/// </summary>
|
||||
/// <param name="x">X</param>
|
||||
/// <param name="y">Y</param>
|
||||
/// <returns>True if coordinates are inside the map</returns>
|
||||
public bool IsInside(int x, int y)
|
||||
{
|
||||
return x >= 0 && y >= 0 && x < Width && y < Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user