Files
Corupture/scripts/interaction_bar.gd

21 lines
552 B
GDScript

extends ProgressBar
class_name InteractionBar
signal interaction_finished
var grid_position: Vector2i
func _ready() -> void:
position = Grid.grid_to_world_center(grid_position) - Vector2(30,10)
var tween = get_tree().create_tween()
tween.tween_property(self, "value", 100, 3)
tween.tween_callback(_cleanup_gather)
func _cleanup_gather() -> void:
interaction_finished.emit()
#TODO add the interaction for buildings
var res: GameResource = Grid.get_location_data(grid_position).get_resource()
ResourceManager.pickup(res)
self.queue_free()