extends Control

onready var scene = $"/root/scene" as GameInstance

func _physics_process(_delta):
	var speed_str = str(round(scene.world.map.current_ship_speed)) + " u/s"
	$Container/VelocityBox/HBoxContainer3/CurrentSpeed.text = speed_str
	var dir_str = str(round(rad2deg(scene.world.map.current_ship_direction))) + " deg"
	$Container/VelocityBox/HBoxContainer2/CurrentDirection.text = dir_str

func _ship_velocity_changed(value):
	scene.process_command(UICommand.new(UICommand.CommandType.SetShipSpeed, [value]))

func _ship_direction_changed(value):
	scene.process_command(UICommand.new(UICommand.CommandType.SetShipDirection, [deg2rad(value)]))
