onion test 0
This commit is contained in:
23
scripts/Entity/OnionSprig.gd
Normal file
23
scripts/Entity/OnionSprig.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
class_name OnionSprig extends StaticBody3D
|
||||
|
||||
@export var itemType:ItemType = ItemType.ONION;
|
||||
|
||||
func _ready() -> void:
|
||||
$Entity/EntityInteractable.onInteract.connect(
|
||||
self.onEntityInteract
|
||||
)
|
||||
|
||||
func _exit_tree() -> void:
|
||||
$Entity/EntityInteractable.onInteract.disconnect(
|
||||
self.onEntityInteract
|
||||
)
|
||||
|
||||
func onEntityInteract(
|
||||
interactor:EntityInteractor,
|
||||
interactee:EntityInteractable
|
||||
) -> void:
|
||||
ITEM.PLAYER_INVENTORY.addItem(ITEM.ONION);
|
||||
|
||||
# Dispose self
|
||||
get_parent().remove_child(self)
|
||||
self.queue_free()
|
Reference in New Issue
Block a user