You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
729 B

  1. extends BasisInteraction
  2. class_name TalkInteraction
  3. var is_talking = false
  4. export var yarnScript : Resource
  5. var yarnRunner := YarnRunner.new()
  6. func _ready():
  7. yarnRunner.add_command("SpawnCoins", funcref($"../../../Coins", "spawn_coins"))
  8. func on_interact():
  9. if not is_talking:
  10. yarnRunner.say_func = funcref(Controller.speech_panel.text, "on_new_line")
  11. yarnRunner.choices_func = funcref(Controller.speech_panel.choices, "on_choices")
  12. yarnRunner.yarnScript = self.yarnScript
  13. is_talking = true
  14. Controller.speech_panel.show()
  15. Controller.player_input_enabled = false
  16. yield(yarnRunner.run_all(), "completed")
  17. Controller.player_input_enabled = true
  18. Controller.speech_panel.hide()
  19. is_talking = false