Interaction wheel
do interaction
This commit is contained in:
@@ -40,20 +40,6 @@ func is_corrupted() -> bool:
|
||||
func has_layer(layer: int) -> bool:
|
||||
return layer_info.has(layer)
|
||||
|
||||
func interact(timer: Timer) -> void:
|
||||
var is_interactable := has_resource() or not has_building()
|
||||
if is_interactable and not interaction_display:
|
||||
timer.timeout.connect(_on_interaction_finished.bind(timer))
|
||||
timer.start(3)
|
||||
|
||||
interaction_display = ProgressBar.new()
|
||||
interaction_display.position = Grid.grid_to_world_center(_pos) - Vector2(30, 10)
|
||||
interaction_display.size = Vector2(60, 20)
|
||||
interaction_display.show_percentage = false
|
||||
var tween = timer.get_tree().create_tween()
|
||||
tween.tween_property(interaction_display, "value", 100, 3)
|
||||
timer.get_parent().add_sibling(interaction_display)
|
||||
|
||||
func get_interaction_options() -> Array[Interaction]:
|
||||
var interactions: Array[Interaction] = []
|
||||
if has_resource():
|
||||
@@ -61,9 +47,3 @@ func get_interaction_options() -> Array[Interaction]:
|
||||
if not has_building():
|
||||
interactions.append(BUILD)
|
||||
return interactions
|
||||
|
||||
func _on_interaction_finished(timer: Timer) -> void:
|
||||
timer.timeout.disconnect(_on_interaction_finished)
|
||||
if has_resource():
|
||||
interaction_display.queue_free()
|
||||
get_resource().gained_resource.emit(get_resource())
|
||||
|
||||
Reference in New Issue
Block a user