class_name InputPromptsCenter
extends CenterContainer
## Manage the display of several inputs prompts


signal prompt_vehicle(enable: bool)
signal prompt_jeep(enable: bool)
signal prompt_plane(enable: bool)
signal prompt_walker(enable: bool)


func _on_title_screen_start_game() -> void:
	var WalkPrompts: PromptContainer = $InputPromptsCollection/WalkPrompts
	var VehiclePrompts: PromptContainer = $InputPromptsCollection/VehiclePrompts
	var JeepPrompts: PromptContainer = $InputPromptsCollection/VehiclePrompts/JeepPrompts
	var PlanePrompts: PromptContainer = $InputPromptsCollection/VehiclePrompts/PlanePrompts

	prompt_walker.connect(WalkPrompts.switch)
	prompt_vehicle.connect(VehiclePrompts.switch)
	prompt_jeep.connect(JeepPrompts.switch)
	prompt_plane.connect(PlanePrompts.switch)

	_enable_walker_prompts()
	_disable_vehicle_prompts()


func _on_victory_menu_visibility_changed() -> void:
	queue_free()


func _enable_walker_prompts() -> void:
	prompt_walker.emit(true)


func _disable_walker_prompts() -> void:
	prompt_walker.emit(false)


func _enable_vehicle_prompts_of(vehicle: SeatedVehicle) -> void:
	prompt_vehicle.emit(true)

	if vehicle is Jeep:
		prompt_jeep.emit(true)
	if vehicle is Biplan:
		prompt_plane.emit(true)
	# todo : rocket


func _disable_vehicle_prompts() -> void:
	prompt_jeep.emit(false)
	prompt_plane.emit(false)

	prompt_vehicle.emit(false)


func _on_main_walker_got_in(vehicle: SeatedVehicle) -> void:
	_disable_walker_prompts()
	_enable_vehicle_prompts_of(vehicle)


func _on_main_walker_got_out() -> void:
	_enable_walker_prompts()
	_disable_vehicle_prompts()
