From a40d0aa60b2656964af8b2eced4016ee6b6f783a Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 11 Jun 2023 13:28:33 +0200 Subject: [PATCH] Connect TileWorld size with WorldGenerator UI. --- scenes/Game.cs | 4 ++++ scenes/Game.tscn | 1 + scenes/TileWorld.cs | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scenes/Game.cs b/scenes/Game.cs index a133fc2..1dfe31c 100644 --- a/scenes/Game.cs +++ b/scenes/Game.cs @@ -75,6 +75,10 @@ public class Game : Spatial _camera = (Camera)FindNode("Camera"); _cameraOffset = _camera.GlobalTranslation - _player.GlobalTranslation; + // populate UI values + Slider generatorWorldSizeSlider = worldGeneratorContainer.GetNode("HBoxContainer/WorldSizeSlider"); + generatorWorldSizeSlider.Value = _tileWorld.Size; + Debug.Assert(_tileWorld != null); // resources diff --git a/scenes/Game.tscn b/scenes/Game.tscn index d64d36c..6314f18 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -44,6 +44,7 @@ visible = false transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 ) [node name="TileWorld" parent="." instance=ExtResource( 8 )] +Size = 32 [node name="DebugContainer" type="PanelContainer" parent="."] visible = false diff --git a/scenes/TileWorld.cs b/scenes/TileWorld.cs index 46d67db..c605902 100644 --- a/scenes/TileWorld.cs +++ b/scenes/TileWorld.cs @@ -21,7 +21,7 @@ public class TileWorld : Spatial delegate void WorldGenerated(); // public members - public int Size = 11; + [Export] public int Size = 64; public float HeightScale = 2.0f; public Image Heightmap; public Image Colormap;