2020-03-18 16:20:55 +01:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
var label = "label" setget label_set
|
2020-09-01 17:24:21 +02:00
|
|
|
var target: String setget target_set
|
2020-09-03 17:50:03 +02:00
|
|
|
var repository: Container
|
2020-03-18 16:20:55 +01:00
|
|
|
|
|
|
|
func _ready():
|
2020-08-24 16:48:30 +02:00
|
|
|
pass
|
2020-03-18 16:20:55 +01:00
|
|
|
|
|
|
|
func _process(delta):
|
2020-09-03 17:50:03 +02:00
|
|
|
if repository and repository.objects.has(target):
|
2020-09-01 19:32:33 +02:00
|
|
|
var t = repository.objects[target]
|
|
|
|
#print(t)
|
|
|
|
$Line.points[1] = t.global_position - global_position
|
|
|
|
$Label.position = ($Line.points[0] + $Line.points[1])/2
|
|
|
|
$Tip.position = ($Line.points[0] + $Line.points[1])/2
|
|
|
|
$Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1])
|
2020-08-24 16:48:30 +02:00
|
|
|
|
2020-03-18 16:20:55 +01:00
|
|
|
func label_set(new_label):
|
2020-08-24 16:48:30 +02:00
|
|
|
label = new_label
|
|
|
|
$Label/ID.text = label
|
2020-03-18 16:20:55 +01:00
|
|
|
|
|
|
|
func target_set(new_target):
|
2020-08-24 16:48:30 +02:00
|
|
|
target = new_target
|