2020-01-16 09:44:44 +01:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
|
2020-01-22 17:55:49 +01:00
|
|
|
export(float, 0, 2000, 40) var linear_speed_max := 120.0 setget set_linear_speed_max
|
|
|
|
export(float, 0, 200, 2) var linear_accel_max := 10.0 setget set_linear_accel_max
|
2020-01-16 18:31:02 +01:00
|
|
|
export(float, 0, 5, 0.1) var predict_time := 1.0 setget set_predict_time
|
2020-01-16 09:44:44 +01:00
|
|
|
|
2020-01-16 16:04:27 +01:00
|
|
|
onready var pursuer := $BoundaryManager/Pursuer
|
|
|
|
onready var seeker := $BoundaryManager/Seeker
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2020-01-22 17:55:49 +01:00
|
|
|
pursuer.setup(predict_time, linear_speed_max, linear_accel_max)
|
|
|
|
seeker.setup(predict_time, linear_speed_max, linear_accel_max)
|
2020-01-16 16:04:27 +01:00
|
|
|
|
2020-01-16 09:44:44 +01:00
|
|
|
|
2020-01-22 17:55:49 +01:00
|
|
|
func set_linear_speed_max(value: float) -> void:
|
|
|
|
linear_speed_max = value
|
2020-01-16 09:44:44 +01:00
|
|
|
if not is_inside_tree():
|
|
|
|
return
|
|
|
|
|
2020-01-22 17:55:49 +01:00
|
|
|
pursuer.agent.linear_speed_max = value
|
|
|
|
seeker.agent.linear_speed_max = value
|
2020-01-16 09:44:44 +01:00
|
|
|
|
|
|
|
|
2020-01-22 17:55:49 +01:00
|
|
|
func set_linear_accel_max(value: float) -> void:
|
|
|
|
linear_accel_max = value
|
2020-01-16 09:44:44 +01:00
|
|
|
if not is_inside_tree():
|
|
|
|
return
|
|
|
|
|
2020-01-22 17:55:49 +01:00
|
|
|
pursuer.agent.linear_acceleration_max = value
|
|
|
|
seeker.agent.linear_acceleration_max = value
|
2020-01-16 09:44:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
func set_predict_time(value: float) -> void:
|
2020-01-16 18:31:02 +01:00
|
|
|
predict_time = value
|
2020-01-16 09:44:44 +01:00
|
|
|
if not is_inside_tree():
|
|
|
|
return
|
|
|
|
|
2020-01-22 17:55:49 +01:00
|
|
|
pursuer._behavior.predict_time_max = value
|