UnityEditor.HeightmapPainter.ApplyBrush C# (CSharp) Method

ApplyBrush() private method

private ApplyBrush ( float height, float brushStrength, int x, int y ) : float
height float
brushStrength float
x int
y int
return float
        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;
        }