Attempt2/lib/components/GenericReceiver.gd

27 lines
601 B
GDScript3

extends Node
export(String) var body_entered_function = ""
var call_function: FuncRef
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
if body_entered_function:
call_function = funcref(owner, body_entered_function)
#call_function.call_func()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func on_body_entered(sender):
print("Receiving call from " + sender.name)
if body_entered_function:
call_function.call_func(sender)