Minor cosmetic changes to terrain code

main
copygirl 3 months ago
parent cc55db6801
commit e65a88e654
  1. 11
      terrain/Terrain+Editing.cs

@ -25,7 +25,7 @@ public partial class Terrain
if (!pressed) return;
const float AdjustHeight = 0.5f;
var value = (wheel == MouseButton.WheelUp)
var amount = (wheel == MouseButton.WheelUp)
? AdjustHeight : -AdjustHeight;
var selection = TileRegion.From(_selection.Value);
@ -41,7 +41,7 @@ public partial class Terrain
var outerHeight = GetCornerHeights(outerPos)[outerCorner];
if (IsEqualApprox(outerHeight, innerHeight))
SetCornerHeight(outerPos, outerCorner, innerHeight + value);
SetCornerHeight(outerPos, outerCorner, innerHeight + amount);
}
// Raise connected sides.
@ -58,12 +58,13 @@ public partial class Terrain
var current = outerHeights;
var changed = false;
foreach (var (innerCorner, outerCorner) in new[]{ (innerCorner1, outerCorner1), (innerCorner2, outerCorner2) }) {
var matchingCorners = new[]{ (innerCorner1, outerCorner1), (innerCorner2, outerCorner2) };
foreach (var (innerCorner, outerCorner) in matchingCorners) {
var innerHeight = innerHeights[innerCorner];
var outerHeight = outerHeights[outerCorner];
if (IsEqualApprox(outerHeight, innerHeight)) {
current = current.With(outerCorner, innerHeight + value);
current = current.With(outerCorner, innerHeight + amount);
changed = true;
}
}
@ -74,7 +75,7 @@ public partial class Terrain
// Raise selected tiles themselves.
foreach (var tile in selection.GetAllTiles())
AdjustTileHeight(tile, value);
AdjustTileHeight(tile, amount);
UpdateMeshAndShape();
NotifyPropertyListChanged();

Loading…
Cancel
Save