start train after horn
This commit is contained in:
@@ -1,4 +1,53 @@
|
|||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
|
@export var play_departure_speed: float = -6.0
|
||||||
|
@export var play_departure_delay_seconds: float = 1.0
|
||||||
|
@export var play_move_before_transition_seconds: float = 3.0
|
||||||
|
|
||||||
|
var _play_departure_started: bool = false
|
||||||
|
|
||||||
|
@onready var _rail_path: Node = $rail
|
||||||
|
@onready var _option_menu: Control = $MainMenuUI/SubViewport/OptionMenu
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass
|
_stop_menu_train()
|
||||||
|
_configure_play_transition_delay()
|
||||||
|
_connect_play_button()
|
||||||
|
|
||||||
|
func _configure_play_transition_delay() -> void:
|
||||||
|
if _option_menu == null or not "fade_time" in _option_menu:
|
||||||
|
return
|
||||||
|
|
||||||
|
_option_menu.set("fade_time", play_departure_delay_seconds + play_move_before_transition_seconds)
|
||||||
|
|
||||||
|
func _stop_menu_train() -> void:
|
||||||
|
if _rail_path == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
_rail_path.set("is_inmotion", false)
|
||||||
|
_rail_path.set("stop_multiply", 1.0)
|
||||||
|
|
||||||
|
func _connect_play_button() -> void:
|
||||||
|
if _option_menu == null or not "play_button" in _option_menu:
|
||||||
|
return
|
||||||
|
|
||||||
|
var play_button := _option_menu.get("play_button") as Button
|
||||||
|
if play_button == null:
|
||||||
|
return
|
||||||
|
if not play_button.pressed.is_connected(_on_play_button_pressed):
|
||||||
|
play_button.pressed.connect(_on_play_button_pressed)
|
||||||
|
|
||||||
|
func _on_play_button_pressed() -> void:
|
||||||
|
if _rail_path == null or _play_departure_started:
|
||||||
|
return
|
||||||
|
|
||||||
|
_play_departure_started = true
|
||||||
|
await get_tree().create_timer(play_departure_delay_seconds).timeout
|
||||||
|
if not is_inside_tree():
|
||||||
|
return
|
||||||
|
|
||||||
|
_rail_path.set("train_speed", play_departure_speed)
|
||||||
|
_rail_path.set("stop_multiply", 1.0)
|
||||||
|
_rail_path.set("is_restarting", false)
|
||||||
|
_rail_path.set("stop_ongoing", false)
|
||||||
|
_rail_path.set("is_inmotion", true)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ godray_spawn_offset = Vector3(20, 80, 20)
|
|||||||
godray_rotation_degrees = Vector3(50, 30, 0)
|
godray_rotation_degrees = Vector3(50, 30, 0)
|
||||||
godray_scale = Vector3(2, 25, 50)
|
godray_scale = Vector3(2, 25, 50)
|
||||||
train_start_from_random_position = 2
|
train_start_from_random_position = 2
|
||||||
train_start_position = 99.0
|
train_start_position = 98.7
|
||||||
train_start_after_delay = false
|
train_start_after_delay = false
|
||||||
snow_amount = 2000.0
|
snow_amount = 2000.0
|
||||||
wind_amount = 50
|
wind_amount = 50
|
||||||
|
|||||||
Reference in New Issue
Block a user