state.gd 611 B

1234567891011121314151617181920212223242526272829
  1. extends Node
  2. # Base interface for all states: it doesn't do anything by itself,
  3. # but forces us to pass the right arguments to the methods below
  4. # and makes sure every State object had all of these methods.
  5. @warning_ignore("unused_signal")
  6. signal finished(next_state_name: String)
  7. # Initialize the state. E.g. change the animation.
  8. func enter() -> void:
  9. pass
  10. # Clean up the state. Reinitialize values like a timer.
  11. func exit() -> void:
  12. pass
  13. func handle_input(_event: InputEvent) -> void:
  14. pass
  15. func update(_delta: float) -> void:
  16. pass
  17. func _on_animation_finished(_anim_name: String) -> void:
  18. pass