This commit is contained in:
2026-06-30 22:48:47 +02:00
parent 7be800398d
commit c015e5cee8
4 changed files with 53 additions and 15 deletions

View File

@@ -90,11 +90,30 @@ func _time_option_changed(index: int) -> void:
_time_tween = create_tween()
# Always move forward in time for a natural transition
if target_time < current_time:
target_time += 1.0
_time_tween.tween_method(set_time, current_time, target_time, time_transition_duration)
var start_time = current_time
# Gestione logica lineare: Notte(0.0) - Mattina(0.25) - Giorno(0.45) - Tramonto(0.8) - Notte(1.0)
# Per evitare di attraversare fasi intermedie opposte, forziamo il percorso su questo segmento.
if index == TIME_OPTION_NIGHT:
# Da Mattina a Notte -> andiamo a 0.0. Dal Giorno in poi -> andiamo a 1.0.
if start_time < environment_config.day:
target_time = 0.0
else:
target_time = 1.0
else:
# Se partiamo da Notte (valori vicini a 0.0 o 1.0)
if start_time < 0.1 or start_time > 0.9:
if index == TIME_OPTION_SUNRISE:
# Per andare a Mattina, partiamo dal lato 0.0
if start_time > 0.9:
start_time -= 1.0
else:
# Per andare a Giorno o Tramonto, partiamo dal lato 1.0
if start_time < 0.1:
start_time += 1.0
_time_tween.tween_method(set_time, start_time, target_time, time_transition_duration)
func _on_set_day_time(value: float) -> void:
set_time(value)