add flash and thunders
This commit is contained in:
@@ -253,6 +253,7 @@ wind_speed = 2.0
|
||||
ambient_intensity_multiplier = 0.6
|
||||
fog_density_multiplier = 2.0
|
||||
rain_intensity = 0.7
|
||||
lightning_enabled = true
|
||||
default_transition_duration = 8.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_mr14h"]
|
||||
@@ -344,7 +345,7 @@ presets = Array[ExtResource("3_c6jpa")]([SubResource("Resource_ajt3x"), SubResou
|
||||
|
||||
[node name="DayNightController" type="Node" parent="." unique_id=1083149574]
|
||||
script = ExtResource("3_day_night")
|
||||
time_of_day = 0.6330777230246745
|
||||
time_of_day = 0.7679742411724282
|
||||
current_day = 4
|
||||
sun_color_curve = SubResource("Gradient_sxvon")
|
||||
sun_intensity_curve = SubResource("Curve_fm80q")
|
||||
@@ -369,10 +370,10 @@ script = ExtResource("5_clouds")
|
||||
layer_configs = Array[ExtResource("4_ssi15")]([SubResource("Resource_xh4oc"), SubResource("Resource_ahi10"), SubResource("Resource_a5xai"), SubResource("Resource_uxs4q")])
|
||||
global_coverage = 0.2
|
||||
global_wind_speed = 0.5
|
||||
sun_direction = Vector3(-0.71683276, 0.6476549, 0.25825176)
|
||||
sun_direction = Vector3(-0.99265814, -0.112351425, -0.04480003)
|
||||
sun_color = Color(1, 0.95, 0.85, 1)
|
||||
sun_intensity = 1.2
|
||||
moon_direction = Vector3(-0.7310799, -0.6605271, -0.17095698)
|
||||
moon_direction = Vector3(-0.9932351, 0.11241673, 0.029095592)
|
||||
moon_color = Color(0.8, 0.85, 1, 1)
|
||||
moon_intensity = 0.0
|
||||
|
||||
@@ -384,11 +385,11 @@ sky_top_color = Color(0.2, 0.4, 0.85, 1)
|
||||
sky_horizon_color = Color(0.6, 0.75, 0.95, 1)
|
||||
sky_bottom_color = Color(0.5, 0.6, 0.7, 1)
|
||||
skybox_texture = ExtResource("6_ssi15")
|
||||
fog_color = Color(0.7, 0.64355034, 0.6637131, 1)
|
||||
fog_density = 0.012741526
|
||||
fog_color = Color(0.6533633, 0.5148431, 0.4713005, 1)
|
||||
fog_density = 0.015073524
|
||||
sun_glow_intensity = 0.3
|
||||
sun_glow_color = Color(1, 0.95, 0.85, 1)
|
||||
sun_direction = Vector3(-0.71683276, 0.6476549, 0.25825176)
|
||||
sun_direction = Vector3(-0.99265814, -0.112351425, -0.04480003)
|
||||
|
||||
[node name="VFXController" type="Node3D" parent="." unique_id=207251300]
|
||||
script = ExtResource("7_vfx")
|
||||
@@ -403,13 +404,13 @@ environment = ExtResource("13_2w5ig")
|
||||
compositor = SubResource("Compositor_ssi15")
|
||||
|
||||
[node name="SunLight" type="DirectionalLight3D" parent="." unique_id=1278065589]
|
||||
transform = Transform3D(0.33894238, 0.9407005, -0.014151112, 0, 0.015041453, 0.9998871, 0.9408068, -0.33890405, 0.0050981897, 0, 50, 0)
|
||||
light_color = Color(1, 0.84032553, 0.65726346, 1)
|
||||
light_energy = 0.58916044
|
||||
transform = Transform3D(-0.04508543, 0.9987848, -0.019893857, 0, 0.019914096, 0.99980193, 0.99898285, 0.045076493, -0.00089783635, 0, 50, 0)
|
||||
light_color = Color(1, 0.7215246, 0.44304925, 1)
|
||||
light_energy = 0.31373072
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="MoonLight" type="DirectionalLight3D" parent="." unique_id=52072807]
|
||||
transform = Transform3D(-0.22769909, 0.9736189, -0.014815218, 0, 0.015214887, 0.9998845, 0.9737314, 0.22767279, -0.0034644168, 0, 50, 0)
|
||||
transform = Transform3D(0.029281195, 0.99937487, -0.01981562, 0, 0.019824117, 0.9998037, 0.999571, -0.02927545, 0.00058047404, 0, 50, 0)
|
||||
visible = false
|
||||
light_color = Color(0.7, 0.8, 1, 1)
|
||||
light_energy = 0.0
|
||||
|
||||
@@ -110,7 +110,7 @@ shader_parameter/sky_bottom_color = Color(0.5, 0.6, 0.7, 1)
|
||||
shader_parameter/gradient_intensity = 1.0
|
||||
shader_parameter/horizon_blend = 0.5
|
||||
shader_parameter/sun_glow_enabled = true
|
||||
shader_parameter/sun_direction = Vector3(-0.71683276, 0.6476549, 0.25825176)
|
||||
shader_parameter/sun_direction = Vector3(-0.99265814, -0.112351425, -0.04480003)
|
||||
shader_parameter/sun_glow_color = Color(1, 0.95, 0.85, 1)
|
||||
shader_parameter/sun_glow_intensity = 0.3
|
||||
shader_parameter/sun_glow_size = 0.2
|
||||
@@ -128,9 +128,9 @@ sky_material = SubResource("ShaderMaterial_jmmec")
|
||||
[resource]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_ssi15")
|
||||
ambient_light_color = Color(0.5733876, 0.5701628, 0.64355034, 1)
|
||||
ambient_light_energy = 0.52610695
|
||||
ambient_light_color = Color(0.5162781, 0.4713005, 0.523453, 1)
|
||||
ambient_light_energy = 0.32816777
|
||||
fog_enabled = true
|
||||
fog_light_color = Color(0.7, 0.64355034, 0.6637131, 1)
|
||||
fog_density = 0.012741526
|
||||
fog_light_color = Color(0.6533633, 0.5148431, 0.4713005, 1)
|
||||
fog_density = 0.015073524
|
||||
fog_height_density = 0.1
|
||||
|
||||
@@ -93,6 +93,8 @@ static func create_rain() -> WeatherProfile:
|
||||
profile.ambient_intensity_multiplier = 0.6
|
||||
profile.fog_density_multiplier = 2.0
|
||||
profile.rain_intensity = 0.7
|
||||
profile.lightning_enabled = true
|
||||
profile.lightning_frequency = 0.04
|
||||
profile.default_transition_duration = 8.0
|
||||
return profile
|
||||
|
||||
|
||||
@@ -465,6 +465,10 @@ func _sync_weather_vfx() -> void:
|
||||
return
|
||||
weather_vfx.set_rain_intensity(weather_controller.get_rain_intensity())
|
||||
weather_vfx.set_snow_intensity(weather_controller.get_snow_intensity())
|
||||
weather_vfx.set_lightning(
|
||||
weather_controller.is_lightning_active(),
|
||||
weather_controller.get_lightning_frequency()
|
||||
)
|
||||
|
||||
|
||||
func _update_debug_info() -> void:
|
||||
|
||||
@@ -19,6 +19,12 @@ extends Node3D
|
||||
@export var lightning_color: Color = Color(0.9, 0.9, 1.0)
|
||||
@export var lightning_flash_duration: float = 0.15
|
||||
|
||||
@export_group("Thunder")
|
||||
@export var thunder_enabled: bool = true
|
||||
@export var thunder_min_delay: float = 1.0
|
||||
@export var thunder_max_delay: float = 5.0
|
||||
@export var thunder_volume_db: float = -2.0
|
||||
|
||||
var _rain_particles: GPUParticles3D
|
||||
var _snow_particles: GPUParticles3D
|
||||
var _rain_material: ShaderMaterial
|
||||
@@ -33,12 +39,16 @@ var _lightning_timer: float = 0.0
|
||||
var _lightning_next: float = 0.0
|
||||
var _lightning_flash_timer: float = 0.0
|
||||
var _lightning_light: DirectionalLight3D
|
||||
var _thunder_player: AudioStreamPlayer
|
||||
var _thunder_pending: bool = false
|
||||
var _thunder_delay_timer: float = 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_create_rain_system()
|
||||
_create_snow_system()
|
||||
_create_lightning_light()
|
||||
_create_thunder_player()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
@@ -56,6 +66,7 @@ func _process(delta: float) -> void:
|
||||
_snow_material.set_shader_parameter("alpha_mult", _current_snow)
|
||||
|
||||
_process_lightning(delta)
|
||||
_process_thunder(delta)
|
||||
_follow_camera()
|
||||
|
||||
|
||||
@@ -87,6 +98,36 @@ func _trigger_lightning() -> void:
|
||||
_lightning_light.visible = true
|
||||
_lightning_light.rotation_degrees.x = randf_range(-80.0, -50.0)
|
||||
_lightning_light.rotation_degrees.y = randf_range(-180.0, 180.0)
|
||||
|
||||
if thunder_enabled:
|
||||
_thunder_pending = true
|
||||
_thunder_delay_timer = randf_range(thunder_min_delay, thunder_max_delay)
|
||||
|
||||
|
||||
func _process_thunder(delta: float) -> void:
|
||||
if not _thunder_pending:
|
||||
return
|
||||
|
||||
_thunder_delay_timer -= delta
|
||||
if _thunder_delay_timer <= 0.0:
|
||||
_thunder_pending = false
|
||||
_play_thunder()
|
||||
|
||||
|
||||
func _play_thunder() -> void:
|
||||
if _thunder_player == null:
|
||||
return
|
||||
|
||||
_thunder_player.play()
|
||||
|
||||
|
||||
func _create_thunder_player() -> void:
|
||||
_thunder_player = AudioStreamPlayer.new()
|
||||
_thunder_player.name = "ThunderPlayer"
|
||||
_thunder_player.volume_db = thunder_volume_db
|
||||
_thunder_player.bus = "Master"
|
||||
_thunder_player.stream = load("res://resources/thunder.mp3")
|
||||
add_child(_thunder_player)
|
||||
|
||||
|
||||
func _create_lightning_light() -> void:
|
||||
|
||||
BIN
resources/thunder.mp3
Normal file
BIN
resources/thunder.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user