godot-steering-ai-framework/project/demos/pursue_vs_seek/GUI.gd

39 lines
1.4 KiB
GDScript3
Raw Normal View History

extends PanelContainer
2019-12-21 21:20:06 +01:00
signal linear_speed_changed(value)
signal linear_accel_changed(value)
signal angular_speed_changed(value)
signal angular_accel_changed(value)
signal decel_radius_changed(value)
signal predict_time_changed(value)
2019-12-21 21:20:06 +01:00
onready var linear_speed: = $GUI/Controls/LinSpeedBox/MaxLinSpeed
onready var lin_speed_label: = $GUI/Controls/LinSpeedBox/Label
onready var linear_accel: = $GUI/Controls/LinAccelBox/MaxLinAccel
onready var lin_accel_label: = $GUI/Controls/LinAccelBox/Label
onready var predict_time: = $GUI/Controls/PredictTime/PredictTime
onready var predict_time_label: = $GUI/Controls/PredictTime/Label
2019-12-21 21:20:06 +01:00
func _ready() -> void:
linear_speed.connect("value_changed", self, "_on_Slider_linear_speed_changed")
linear_accel.connect("value_changed", self, "_on_Slider_linear_accel_changed")
predict_time.connect("value_changed", self, "_on_Slider_predict_time_changed")
2019-12-21 21:20:06 +01:00
func _on_Slider_linear_speed_changed(value: float) -> void:
lin_speed_label.text = "Max linear speed (" + str(value) + ")"
emit_signal("linear_speed_changed", value)
2019-12-21 21:20:06 +01:00
func _on_Slider_linear_accel_changed(value: float) -> void:
lin_accel_label.text = "Max linear accel (" + str(value) + ")"
emit_signal("linear_accel_changed", value)
2019-12-21 21:20:06 +01:00
func _on_Slider_predict_time_changed(value: float) -> void:
predict_time_label.text = "Predict time (" + str(value) + " sec)"
emit_signal("predict_time_changed", value)