velho/godot/prefabs/tiles/gatherable_animation.gd

17 lines
440 B
GDScript

extends Node
@export var gatherable: Gatherable
@export var picked: CanvasItem
@export var not_picked: CanvasItem
func _ready() -> void:
update_visibility(gatherable.get_is_picked())
gatherable.picked_state_changed.connect(_on_gatherable_state_changed)
func _on_gatherable_state_changed(is_picked):
update_visibility(is_picked)
func update_visibility(is_picked: bool):
picked.visible = is_picked
not_picked.visible = not is_picked