Line data Source code
1 : /** 2 : * Sets a random elevation of the given heightrange in the given Area. 3 : */ 4 : function RandomElevationPainter(minHeight, maxHeight) 5 : { 6 1 : this.minHeight = minHeight; 7 1 : this.maxHeight = maxHeight; 8 : } 9 : 10 6 : RandomElevationPainter.prototype.paint = function(area) 11 : { 12 1 : for (let point of area.getPoints()) 13 9 : for (let vertex of g_TileVertices) 14 : { 15 36 : let position = Vector2D.add(point, vertex); 16 36 : if (g_Map.validHeight(position)) 17 36 : g_Map.setHeight(position, randFloat(this.minHeight, this.maxHeight)); 18 : } 19 : };