2019-12-20 19:17:27 +01:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
|
|
|
|
onready var player: = $Player
|
2019-12-23 17:38:27 +01:00
|
|
|
onready var gui: = $GUI
|
|
|
|
onready var turret: = $Turret
|
2019-12-22 20:08:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2019-12-23 17:38:27 +01:00
|
|
|
gui.connect("align_tolerance_changed", self, "_on_GUI_align_tolerance_changed")
|
|
|
|
gui.connect("decel_radius_changed", self, "_on_GUI_decel_radius_changed")
|
|
|
|
gui.connect("max_accel_changed", self, "_on_GUI_max_accel_changed")
|
|
|
|
gui.connect("max_speed_changed", self, "_on_GUI_max_speed_changed")
|
|
|
|
turret.setup()
|
|
|
|
gui.align_tolerance.text = str(int(rad2deg(turret._face.alignment_tolerance)))
|
|
|
|
gui.decel_radius.text = str(int(rad2deg(turret._face.deceleration_radius)))
|
|
|
|
gui.max_speed.text = str(int(rad2deg(turret._agent.max_angular_speed)))
|
|
|
|
gui.max_accel.text = str(int(rad2deg(turret._agent.max_angular_acceleration)))
|
2019-12-22 20:08:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _on_GUI_align_tolerance_changed(value: int) -> void:
|
2019-12-23 17:38:27 +01:00
|
|
|
turret._face.alignment_tolerance = deg2rad(value)
|
2019-12-22 20:08:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _on_GUI_decel_radius_changed(value: int) -> void:
|
2019-12-23 17:38:27 +01:00
|
|
|
turret._face.deceleration_radius = deg2rad(value)
|
2019-12-22 20:08:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _on_GUI_max_accel_changed(value: int) -> void:
|
2019-12-23 17:38:27 +01:00
|
|
|
turret._agent.max_angular_acceleration = deg2rad(value)
|
2019-12-22 20:08:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _on_GUI_max_speed_changed(value: int) -> void:
|
2019-12-23 17:38:27 +01:00
|
|
|
turret._agent.max_angular_speed = deg2rad(value)
|