Connect TileWorld size with WorldGenerator UI.

WorldChunkRefactoring
Martin Felis 2023-06-11 13:28:33 +02:00
parent ed29cc1288
commit a40d0aa60b
3 changed files with 6 additions and 1 deletions

View File

@ -75,6 +75,10 @@ public class Game : Spatial
_camera = (Camera)FindNode("Camera"); _camera = (Camera)FindNode("Camera");
_cameraOffset = _camera.GlobalTranslation - _player.GlobalTranslation; _cameraOffset = _camera.GlobalTranslation - _player.GlobalTranslation;
// populate UI values
Slider generatorWorldSizeSlider = worldGeneratorContainer.GetNode<Slider>("HBoxContainer/WorldSizeSlider");
generatorWorldSizeSlider.Value = _tileWorld.Size;
Debug.Assert(_tileWorld != null); Debug.Assert(_tileWorld != null);
// resources // resources

View File

@ -44,6 +44,7 @@ visible = false
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
[node name="TileWorld" parent="." instance=ExtResource( 8 )] [node name="TileWorld" parent="." instance=ExtResource( 8 )]
Size = 32
[node name="DebugContainer" type="PanelContainer" parent="."] [node name="DebugContainer" type="PanelContainer" parent="."]
visible = false visible = false

View File

@ -21,7 +21,7 @@ public class TileWorld : Spatial
delegate void WorldGenerated(); delegate void WorldGenerated();
// public members // public members
public int Size = 11; [Export] public int Size = 64;
public float HeightScale = 2.0f; public float HeightScale = 2.0f;
public Image Heightmap; public Image Heightmap;
public Image Colormap; public Image Colormap;