victory.gd 862 B

1234567891011121314151617181920212223242526272829303132333435
  1. extends Control
  2. class_name Victory
  3. signal loot_selected(index: int)
  4. @onready var animation: AnimationPlayer = $AnimationPlayer
  5. @onready var loot_button_1: Button = $VBoxContainer/Loot1Button
  6. @onready var loot_button_2: Button = $VBoxContainer/Loot2Button
  7. @onready var loot_button_3: Button = $VBoxContainer/Loot3Button
  8. var selection: int = -1
  9. func _ready() -> void:
  10. animation.play("open")
  11. func set_loot_options(opt1: String, opt2: String, opt3: String) -> void:
  12. loot_button_1.text = opt1
  13. loot_button_2.text = opt2
  14. loot_button_3.text = opt3
  15. func close(selected_loot: int) -> void:
  16. selection = selected_loot
  17. animation.play("close")
  18. await animation.animation_finished
  19. loot_selected.emit(selected_loot)
  20. queue_free()
  21. func _on_loot_1_button_pressed():
  22. close(0)
  23. func _on_loot_2_button_pressed():
  24. close(1)
  25. func _on_loot_3_button_pressed():
  26. close(2)