Files
Corupture/scripts/interaction_bar.gd
Eric d74bfda9a3 Made building consume resources
Now may build more than one if resources allow
building placement is red/green for indicating success
2024-03-10 07:51:41 -05:00

20 lines
511 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()
var res: GameResource = Grid.get_location_data(grid_position).get_resource()
ResourceManager.pickup(res)
self.queue_free()