fix snow stuff
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
[gd_resource type="ShaderMaterial" format=3 uid="uid://buknp8uj4o22p"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://cw7lu2soglhqu" path="res://Shaders/Grain_Test.gdshader" id="1_etun4"]
|
||||
[ext_resource type="Shader" uid="uid://co2jw3fnyc6aa" path="res://Shaders/tree_leaves.gdshader" id="1_etun4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dluagib52he0x" path="res://Assets/Textures/grass_thin.png" id="2_j223e"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_etun4")
|
||||
shader_parameter/billboard_enabled = true
|
||||
shader_parameter/wind_enabled = true
|
||||
shader_parameter/base_color = Color(0.6910962, 0.46426672, 0.08072326, 1)
|
||||
shader_parameter/alpha_texture = ExtResource("2_j223e")
|
||||
shader_parameter/leaves_scale = 1.0
|
||||
shader_parameter/rotation_degrees = 180.0
|
||||
shader_parameter/texture_offset = Vector2(0, 0)
|
||||
shader_parameter/opacity = 1.0
|
||||
shader_parameter/snow_color = Color(0.85, 0.9, 0.95, 1)
|
||||
shader_parameter/height_min = 0.0
|
||||
shader_parameter/height_max = 5.0
|
||||
shader_parameter/shadow_intensity = 0.5
|
||||
|
||||
@@ -3,6 +3,32 @@
|
||||
[ext_resource type="PackedScene" uid="uid://dopxtbmauwr0n" path="res://Assets/Test/Colonnina_Blockout.fbx" id="1_iaqs2"]
|
||||
[ext_resource type="Material" uid="uid://da8erd0d83kog" path="res://Materials/Palette_Cel.tres" id="2_hqihs"]
|
||||
[ext_resource type="Texture2D" uid="uid://cdlgd0h5qeb7k" path="res://Assets/Textures/Palette_train.png" id="3_jfj3v"]
|
||||
[ext_resource type="Shader" uid="uid://do0tct77dfhef" path="res://Shaders/snow.gdshader" id="3_ptdo2"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dg33q"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_ptdo2")
|
||||
shader_parameter/snow_color = Color(0.95, 0.98, 1, 1)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lrklx"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_ptdo2")
|
||||
shader_parameter/snow_color = Color(0.95, 0.98, 1, 1)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bwl3q"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_ptdo2")
|
||||
shader_parameter/snow_color = Color(0.95, 0.98, 1, 1)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_n0srh"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_ptdo2")
|
||||
shader_parameter/snow_color = Color(0.95, 0.98, 1, 1)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0mbrm"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_ptdo2")
|
||||
shader_parameter/snow_color = Color(0.95, 0.98, 1, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6tlqt"]
|
||||
specular_mode = 1
|
||||
@@ -14,27 +40,42 @@ emission_enabled = true
|
||||
emission_energy_multiplier = 8.0
|
||||
emission_texture = ExtResource("3_jfj3v")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7dodf"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_ptdo2")
|
||||
shader_parameter/snow_color = Color(0.95, 0.98, 1, 1)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_63xe0"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_ptdo2")
|
||||
shader_parameter/snow_color = Color(0.95, 0.98, 1, 1)
|
||||
|
||||
[node name="ArtTest3" unique_id=143340255 instance=ExtResource("1_iaqs2")]
|
||||
|
||||
[node name="Empty" parent="." index="0" unique_id=1671039315]
|
||||
[node name="Empty" parent="." index="0" unique_id=1399041374]
|
||||
transform = Transform3D(50, 0, 0, 0, -2.1855694e-06, 50, 0, -50, -2.1855694e-06, 0, 0, 0)
|
||||
|
||||
[node name="Cube_004" parent="Empty" index="0" unique_id=1602644254]
|
||||
[node name="Cube_004" parent="Empty" index="0" unique_id=1076888931]
|
||||
material_override = ExtResource("2_hqihs")
|
||||
material_overlay = SubResource("ShaderMaterial_dg33q")
|
||||
|
||||
[node name="Cube_005" parent="Empty" index="1" unique_id=1550621633]
|
||||
[node name="Cube_005" parent="Empty" index="1" unique_id=257441775]
|
||||
material_override = ExtResource("2_hqihs")
|
||||
material_overlay = SubResource("ShaderMaterial_lrklx")
|
||||
|
||||
[node name="Cube_006" parent="Empty" index="2" unique_id=1497731252]
|
||||
[node name="Cube_006" parent="Empty" index="2" unique_id=1211401951]
|
||||
material_override = ExtResource("2_hqihs")
|
||||
material_overlay = SubResource("ShaderMaterial_bwl3q")
|
||||
|
||||
[node name="Cube_007" parent="Empty" index="3" unique_id=259390191]
|
||||
[node name="Cube_007" parent="Empty" index="3" unique_id=323750734]
|
||||
material_override = ExtResource("2_hqihs")
|
||||
material_overlay = SubResource("ShaderMaterial_n0srh")
|
||||
|
||||
[node name="Cube_008" parent="Empty" index="4" unique_id=1357576798]
|
||||
[node name="Cube_008" parent="Empty" index="4" unique_id=2097566020]
|
||||
material_override = ExtResource("2_hqihs")
|
||||
material_overlay = SubResource("ShaderMaterial_0mbrm")
|
||||
|
||||
[node name="Cube_009" parent="Empty" index="5" unique_id=1102627943]
|
||||
[node name="Cube_009" parent="Empty" index="5" unique_id=264106945]
|
||||
material_override = SubResource("StandardMaterial3D_6tlqt")
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="Empty/Cube_009" index="0" unique_id=1295876317]
|
||||
@@ -46,8 +87,10 @@ omni_range = 15.0
|
||||
omni_attenuation = 2.621
|
||||
omni_shadow_mode = 0
|
||||
|
||||
[node name="Cube_011" parent="Empty" index="6" unique_id=556675018]
|
||||
[node name="Cube_011" parent="Empty" index="6" unique_id=1497976141]
|
||||
material_override = ExtResource("2_hqihs")
|
||||
material_overlay = SubResource("ShaderMaterial_7dodf")
|
||||
|
||||
[node name="tetto 2" parent="Empty" index="7" unique_id=1317509787]
|
||||
[node name="tetto 2" parent="Empty" index="7" unique_id=1754192511]
|
||||
material_override = ExtResource("2_hqihs")
|
||||
material_overlay = SubResource("ShaderMaterial_63xe0")
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -60,7 +60,6 @@ extends Node3D
|
||||
@export var raggio_spawn_vento: float = 25.0
|
||||
@export var altezza_spawn_vento: float = 5.0
|
||||
|
||||
# --- GRUPPO NEVE AGGIORNATO ---
|
||||
@export_group("Neve")
|
||||
@export var bottone_neve: Button
|
||||
@export var bottone_nevicata: Button
|
||||
@@ -87,7 +86,6 @@ var is_cinematic_mode: bool = false
|
||||
var timer_cinematic_env: float = 0.0
|
||||
var sto_cambiando_in_cinematic: bool = false
|
||||
|
||||
# Variabili di stato per la neve
|
||||
var is_snow_accumulated: bool = false
|
||||
var is_actively_snowing: bool = false
|
||||
var snow_tween: Tween
|
||||
@@ -109,7 +107,6 @@ func _ready() -> void:
|
||||
if particelle_pioggia:
|
||||
particelle_pioggia.emitting = false
|
||||
|
||||
# Inizializzazione Lucciole
|
||||
if particelle_lucciole:
|
||||
particelle_lucciole.emitting = false
|
||||
particelle_lucciole.amount = quantita_lucciole
|
||||
@@ -117,7 +114,6 @@ func _ready() -> void:
|
||||
if proc_mat:
|
||||
proc_mat.emission_box_extents = Vector3(raggio_spawn_lucciole, altezza_spawn_lucciole, raggio_spawn_lucciole)
|
||||
|
||||
# Inizializzazione Vento
|
||||
if particelle_vento:
|
||||
particelle_vento.emitting = false
|
||||
particelle_vento.amount = quantita_vento
|
||||
@@ -125,7 +121,6 @@ func _ready() -> void:
|
||||
if proc_mat_vento:
|
||||
proc_mat_vento.emission_box_extents = Vector3(raggio_spawn_vento, altezza_spawn_vento, raggio_spawn_vento)
|
||||
|
||||
# --- INIZIALIZZAZIONE NEVE ---
|
||||
set_snow_amount(0.0)
|
||||
|
||||
if particelle_neve:
|
||||
@@ -173,6 +168,12 @@ func _on_giornata_selezionata(index: int) -> void:
|
||||
trigger_morning()
|
||||
|
||||
func _on_pioggia_toggled(toggled_on: bool) -> void:
|
||||
# Blocchiamo la pioggia se sta già nevicando
|
||||
if is_actively_snowing and toggled_on:
|
||||
if bottone_pioggia:
|
||||
bottone_pioggia.set_pressed_no_signal(false)
|
||||
return
|
||||
|
||||
if not sto_cambiando_in_cinematic and is_cinematic_mode:
|
||||
is_cinematic_mode = false
|
||||
print("Ambiente Cinematic: DISATTIVATA (Pioggia cambiata manualmente)")
|
||||
@@ -196,9 +197,14 @@ func _process(delta: float) -> void:
|
||||
var base_sky_top: Color
|
||||
var base_sky_horizon: Color
|
||||
|
||||
if is_raining:
|
||||
# Usiamo questa variabile per animare le nuvole sia se piove sia se nevica
|
||||
var tempesta_attiva = is_raining or is_actively_snowing
|
||||
|
||||
if tempesta_attiva:
|
||||
intensita_pioggia = move_toward(intensita_pioggia, 1.0, delta * 0.5)
|
||||
|
||||
# I fulmini partono SOLO se sta piovendo
|
||||
if is_raining:
|
||||
timer_prossimo_fulmine -= delta
|
||||
if timer_prossimo_fulmine <= 0.0:
|
||||
_scatena_fulmine()
|
||||
@@ -255,28 +261,22 @@ func _process(delta: float) -> void:
|
||||
materiale_nebbia.set_shader_parameter("night_intensity", night_val)
|
||||
materiale_nebbia.set_shader_parameter("sun_color", final_tint)
|
||||
|
||||
# ==========================================
|
||||
# --- GESTIONE POLVERE, LUCCIOLE E VENTO ---
|
||||
# ==========================================
|
||||
var e_notte = tempo_giorno >= 2.5
|
||||
|
||||
# Polvere (2D): Solo di giorno e senza pioggia
|
||||
if nodo_polvere:
|
||||
if not is_raining and not e_notte:
|
||||
if not tempesta_attiva 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:
|
||||
if not tempesta_attiva 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:
|
||||
if not tempesta_attiva and not e_notte:
|
||||
particelle_vento.emitting = true
|
||||
else:
|
||||
particelle_vento.emitting = false
|
||||
@@ -293,12 +293,16 @@ func _genera_evento_meteo_casuale() -> void:
|
||||
_on_giornata_selezionata(nuovo_orario)
|
||||
|
||||
elif scelta == 1:
|
||||
# Blocca il trigger della pioggia in cinematic mode se nevica
|
||||
if not is_actively_snowing:
|
||||
var piove = randf() > 0.5
|
||||
if bottone_pioggia:
|
||||
bottone_pioggia.set_pressed_no_signal(piove)
|
||||
_on_pioggia_toggled(piove)
|
||||
|
||||
elif scelta == 2:
|
||||
# Blocca il trigger di tempesta/fulmini se nevica
|
||||
if not is_actively_snowing:
|
||||
if not is_raining:
|
||||
if bottone_pioggia:
|
||||
bottone_pioggia.set_pressed_no_signal(true)
|
||||
@@ -372,18 +376,19 @@ func spawn_single_godray() -> void:
|
||||
ray.scale = godray_scale
|
||||
|
||||
# ==========================================
|
||||
# --- LOGICA NEVE AGGIORNATA ---
|
||||
# --- LOGICA NEVE E NEVICATA ---
|
||||
# ==========================================
|
||||
|
||||
func _on_snow_button_pressed():
|
||||
is_snow_accumulated = !is_snow_accumulated
|
||||
|
||||
# Sblocca il pulsante nevicata solo se c'è accumulo
|
||||
if bottone_nevicata:
|
||||
bottone_nevicata.disabled = !is_snow_accumulated
|
||||
|
||||
# Se sciogliamo la neve, fermiamo anche la nevicata attiva
|
||||
if not is_snow_accumulated and is_actively_snowing:
|
||||
# Attiva in automatico la nevicata quando nevica, la spegne quando si scioglie
|
||||
if is_snow_accumulated and not is_actively_snowing:
|
||||
_on_nevicata_button_pressed()
|
||||
elif not is_snow_accumulated and is_actively_snowing:
|
||||
_on_nevicata_button_pressed()
|
||||
|
||||
var target_snow: float = 1.0 if is_snow_accumulated else 0.0
|
||||
@@ -394,12 +399,20 @@ func _on_snow_button_pressed():
|
||||
snow_tween = create_tween()
|
||||
snow_tween.tween_method(set_snow_amount, actual_snow_amount, target_snow, tempo_transizione_neve)
|
||||
|
||||
|
||||
func _on_nevicata_button_pressed():
|
||||
if not is_snow_accumulated:
|
||||
return
|
||||
|
||||
is_actively_snowing = !is_actively_snowing
|
||||
|
||||
# Disabilita il pulsante della pioggia. Se pioveva già, spegne la pioggia.
|
||||
if bottone_pioggia:
|
||||
bottone_pioggia.disabled = is_actively_snowing
|
||||
if is_actively_snowing and is_raining:
|
||||
bottone_pioggia.set_pressed_no_signal(false)
|
||||
_on_pioggia_toggled(false)
|
||||
|
||||
if particelle_neve:
|
||||
particelle_neve.emitting = is_actively_snowing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user