behaviour-tree-test/project/objects/debug_label.tscn
2026-03-20 19:42:36 +01:00

45 lines
1.2 KiB
Text

[gd_scene format=3 uid="uid://ljmtmtljlyoc"]
[sub_resource type="GDScript" id="GDScript_3hb37"]
resource_name = "DebugLabel"
script/source = "extends Label3D
var new_text : String = \"\"
func _behaviour_changed(behaviour : BehaviourNode):
if not new_text.is_empty():
new_text += \"\\n\"
for i in $\"../BehaviourTree\".get_path_to(behaviour).get_name_count() - 2:
new_text += \"| \"
new_text += \"- > \"
new_text += behaviour.get_name()
if behaviour is BehaviourAction:
match behaviour.get_status():
BehaviourNode.Fail:
new_text += \" (FAIL)\"
BehaviourNode.Success:
new_text += \" (SUCCESS)\"
BehaviourNode.Running:
new_text += \" (RUNNING)\"
func _ready():
$\"../BehaviourTree\".current_behaviour_changed.connect(_behaviour_changed)
func _process(_delta):
if not new_text.is_empty():
text = new_text
new_text = \"\"
"
[node name="DebugLabel" type="Label3D" unique_id=1911478572]
process_mode = 3
pixel_size = 0.0005
billboard = 1
fixed_size = true
render_priority = 10
text = "SOMETHING WENT WRONG!!!"
horizontal_alignment = 0
vertical_alignment = 2
autowrap_trim_flags = 0
justification_flags = 0
script = SubResource("GDScript_3hb37")