add wind + dust

This commit is contained in:
Matteo Sonaglioni
2026-03-13 16:42:54 +01:00
parent 6801df2103
commit 6e11a95a3e
15 changed files with 202 additions and 55 deletions

View File

@@ -24,7 +24,6 @@ extends Node3D
@export var materiale_nebbia: ShaderMaterial
@export var materiale_pioggia_gocce: StandardMaterial3D
@export var materiale_nuvole: ShaderMaterial
# --- NUOVO: SLOT NODO POLVERE ---
@export var nodo_polvere: ColorRect
@export_group("Meteo (Pioggia & Fulmini)")
@@ -49,6 +48,19 @@ extends Node3D
@export var godray_spawn_height: float = 5.0
@export var godray_scale: Vector3 = Vector3(2.0, 6.0, 2.0)
@export_group("Lucciole")
@export var particelle_lucciole: GPUParticles3D
@export var quantita_lucciole: int = 60
@export var raggio_spawn_lucciole: float = 20.0
@export var altezza_spawn_lucciole: float = 3.0
# --- NUOVO: GRUPPO VENTO ---
@export_group("Vento")
@export var particelle_vento: GPUParticles3D
@export var quantita_vento: int = 100
@export var raggio_spawn_vento: float = 25.0
@export var altezza_spawn_vento: float = 5.0
@onready var sole: DirectionalLight3D = $DirectionalLight3D
@onready var ambiente: WorldEnvironment = $WorldEnvironment
@onready var menu_giornata: OptionButton = $CanvasLayer/OptionButton
@@ -82,6 +94,22 @@ func _ready() -> void:
if particelle_pioggia:
particelle_pioggia.emitting = false
# Inizializzazione Lucciole
if particelle_lucciole:
particelle_lucciole.emitting = false
particelle_lucciole.amount = quantita_lucciole
var proc_mat = particelle_lucciole.process_material as ParticleProcessMaterial
if proc_mat:
proc_mat.emission_box_extents = Vector3(raggio_spawn_lucciole, altezza_spawn_lucciole, raggio_spawn_lucciole)
# --- NUOVO: INIZIALIZZAZIONE VENTO ---
if particelle_vento:
particelle_vento.emitting = false
particelle_vento.amount = quantita_vento
var proc_mat_vento = particelle_vento.process_material as ParticleProcessMaterial
if proc_mat_vento:
proc_mat_vento.emission_box_extents = Vector3(raggio_spawn_vento, altezza_spawn_vento, raggio_spawn_vento)
_resetta_timer_fulmine()
func _input(event: InputEvent) -> void:
@@ -199,16 +227,30 @@ func _process(delta: float) -> void:
materiale_nebbia.set_shader_parameter("sun_color", final_tint)
# ==========================================
# --- NUOVO: GESTIONE POLVERE INFALLIBILE ---
# --- GESTIONE POLVERE, LUCCIOLE E VENTO ---
# ==========================================
var e_notte = tempo_giorno >= 2.5
# Polvere (2D): Solo di giorno e senza pioggia
if nodo_polvere:
var e_notte = tempo_giorno >= 2.5
# Accende/Spegne brutalmente il nodo
if not is_raining and not e_notte:
nodo_polvere.visible = true
else:
nodo_polvere.visible = false
# Lucciole (3D): Solo di notte e senza pioggia
if particelle_lucciole:
if not is_raining and e_notte:
particelle_lucciole.emitting = true
else:
particelle_lucciole.emitting = false
# Vento (3D): Solo di giorno e senza pioggia
if particelle_vento:
if not is_raining and not e_notte:
particelle_vento.emitting = true
else:
particelle_vento.emitting = false
func _genera_evento_meteo_casuale() -> void:
sto_cambiando_in_cinematic = true