private float ApplyBrush(float height, float brushStrength, int x, int y)
{
if (this.tool == TerrainTool.PaintHeight)
{
return (height + brushStrength);
}
if (this.tool == TerrainTool.SetHeight)
{
if (this.targetHeight > height)
{
height += brushStrength;
height = Mathf.Min(height, this.targetHeight);
return height;
}
height -= brushStrength;
height = Mathf.Max(height, this.targetHeight);
return height;
}
if (this.tool == TerrainTool.SmoothHeight)
{
return Mathf.Lerp(height, this.Smooth(x, y), brushStrength);
}
return height;
}