fixed rain

This commit is contained in:
2025-04-27 15:31:20 +02:00
parent 2e4fc22263
commit d9bde10c3c
3 changed files with 13 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
using System.Reflection; using System.Reflection;
using FOU.Scripts;
using Godot; using Godot;
public partial class SettingsController : VBoxContainer public partial class SettingsController : VBoxContainer
@@ -18,7 +19,7 @@ public partial class SettingsController : VBoxContainer
slSize.Value = main.BrushSize; slSize.Value = main.BrushSize;
slRain.ValueChanged += OnRainValueChanged; slRain.ValueChanged += OnRainValueChanged;
slRain.Value = main.RainAmount; slRain.Value = main.rainAmount;
} }
private void OnSizeValueChanged(double value) { private void OnSizeValueChanged(double value) {

View File

@@ -8,7 +8,7 @@
[node name="Main" type="Node2D"] [node name="Main" type="Node2D"]
script = ExtResource("1_k1i8e") script = ExtResource("1_k1i8e")
DebugMode = true DebugMode = true
BrushSize = 2 BrushSize = 4
RainAmount = 1.0 RainAmount = 1.0
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
@@ -85,6 +85,6 @@ custom_minimum_size = Vector2(150, 0)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 8 size_flags_horizontal = 8
size_flags_vertical = 1 size_flags_vertical = 1
max_value = 5.0 max_value = 10.0
step = 0.01 step = 0.01
value = 1.0 value = 1.0

View File

@@ -9,14 +9,21 @@ public partial class Main : Node2D {
[Export] public int BrushSize = 5; [Export] public int BrushSize = 5;
[Export] public float TextureResolution = 0.5f; [Export] public float TextureResolution = 0.5f;
[Export] public int ChunksPerAxis = 2; [Export] public int ChunksPerAxis = 2;
[Export] public float RainAmount = 0; [Export] public float rainAmount = 0;
public static Main Instance; public static Main Instance;
public Level Level; public Level Level;
private TextureRect mLevelDrawer; private TextureRect mLevelDrawer;
private bool enableRain; private bool enableRain;
private float rainAmount;
public float RainAmount {
get => rainAmount;
set {
rainAmount = value;
Level?.SetRainAmount(rainAmount);
}
}
public override void _Ready() { public override void _Ready() {
Level = new Level(this, (int)(GetViewportRect().Size.X * TextureResolution), Level = new Level(this, (int)(GetViewportRect().Size.X * TextureResolution),