15 lines
359 B
GDScript
15 lines
359 B
GDScript
class_name LootComponent
|
|
extends Node
|
|
|
|
@export var health: HealthComponent
|
|
@export var drop: PackedScene
|
|
|
|
func _ready():
|
|
health.death.connect(on_death)
|
|
|
|
func on_death():
|
|
prints(owner.name, "death")
|
|
var loot := drop.instantiate() as Node3D
|
|
owner.get_parent().add_child(loot)
|
|
loot.global_position = owner.global_position + loot.position
|
|
owner.queue_free() |