summaryrefslogtreecommitdiff
path: root/Units/unit_path_line.gd
blob: e7bd4bc3b86271ef6d4e34a045b1a9849cba8e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extends Line2D


signal points_changed

@export_group("Target Circle", "target_circle")
@export_custom(PROPERTY_HINT_NONE, "suffix:px") var target_circle_radius: float = 0.0
@export var target_circle_color: Color = Color(0,0,0,0)

@onready var last_points = points


func _ready():
	points_changed.connect(func():
		queue_redraw()
	)
	
	if target_circle_color == Color(0,0,0,0):
		target_circle_color = default_color


func _process(_delta):
	if last_points == points:
		points_changed.emit()
	
	last_points = points


func _draw():
	draw_circle(
		points[points.size() - 1] - global_position,
		target_circle_radius,
		default_color
	)