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.

talk_interaction.gd 650 B

1234567891011121314151617181920212223242526
  1. extends BasisInteraction
  2. var is_talking = false
  3. export var yarnScript : Resource
  4. export var speechPanel_path : NodePath
  5. onready var speechPanel := get_node(speechPanel_path)
  6. var yarnRunner := YarnRunner.new()
  7. func on_interact():
  8. if not is_talking:
  9. yarnRunner.say_func = funcref(speechPanel.text, "on_new_line")
  10. yarnRunner.choices_func = funcref(speechPanel.choices, "on_choices")
  11. yarnRunner.yarnScript = self.yarnScript
  12. is_talking = true
  13. speechPanel.show()
  14. Controller.player_input_enabled = false
  15. yield(yarnRunner.run_all(), "completed")
  16. Controller.player_input_enabled = true
  17. speechPanel.hide()
  18. is_talking = false