add tween to time transition
This commit is contained in:
@@ -12,6 +12,10 @@ var environment_config: EnvironmentConfig
|
||||
@export var time_scale: float = 1.0
|
||||
@export var paused: bool = false
|
||||
|
||||
var _time_tween: Tween
|
||||
|
||||
var time_transition_duration: float = 2
|
||||
|
||||
signal time_changed(time: float)
|
||||
|
||||
var current_time: float = 0.0
|
||||
@@ -67,16 +71,30 @@ func get_time_option_index(currtime: float) -> int:
|
||||
return TIME_OPTION_DAY
|
||||
return TIME_OPTION_SUNSET
|
||||
|
||||
|
||||
|
||||
func _time_option_changed(index: int) -> void:
|
||||
var target_time: float = 0.0
|
||||
match index:
|
||||
TIME_OPTION_SUNRISE:
|
||||
set_time(environment_config.sunrise)
|
||||
target_time = environment_config.sunrise
|
||||
TIME_OPTION_DAY:
|
||||
set_time(environment_config.day)
|
||||
target_time = environment_config.day
|
||||
TIME_OPTION_SUNSET:
|
||||
set_time(environment_config.sunset)
|
||||
target_time = environment_config.sunset
|
||||
TIME_OPTION_NIGHT:
|
||||
set_time(environment_config.night)
|
||||
target_time = environment_config.night
|
||||
|
||||
if _time_tween:
|
||||
_time_tween.kill()
|
||||
|
||||
_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)
|
||||
|
||||
func _on_set_day_time(value: float) -> void:
|
||||
set_time(value)
|
||||
|
||||
@@ -8,7 +8,6 @@ extends Control
|
||||
@onready var photo_icon_button: Button = $%PhotoIconButton
|
||||
@onready var choo_choo_button: Button = $%ChooChooButton
|
||||
@onready var collectible_icon_button: Button = $%CollectibleIconButton
|
||||
#@onready var resume_button: Button = $GameMenuPanel/GameMenu/Pages/Page3/OptionMenu/VBoxContainer/ResumeButton
|
||||
@onready var weather_row: HBoxContainer = $%WeatherRow
|
||||
@onready var time_of_day_row: HBoxContainer = $%TimeOfDayRow
|
||||
@onready var photo_mode_texture_panel: Panel = $%PhotoModeTexturePanel
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user