Initial commit
This commit is contained in:
commit
3b96451047
71 changed files with 2302 additions and 0 deletions
33
addons/walkabout/events/event.gd
Normal file
33
addons/walkabout/events/event.gd
Normal file
|
@ -0,0 +1,33 @@
|
|||
@icon("event.svg")
|
||||
class_name WBEvent
|
||||
extends Node
|
||||
## Basic event that does nothing and emits its signals.
|
||||
|
||||
|
||||
## Emitted when the event starts performing.
|
||||
signal event_started()
|
||||
## Emitted when the event has finished performing.
|
||||
signal event_finished()
|
||||
|
||||
|
||||
## [constant true] when the event is currently active.
|
||||
## It is an error to try to perform an event that is already running.
|
||||
var running: bool = false
|
||||
|
||||
|
||||
## Starts the event.
|
||||
func perform() -> void:
|
||||
if running:
|
||||
push_error("Event may not be performed if it is already running.")
|
||||
|
||||
running = true
|
||||
event_started.emit()
|
||||
|
||||
await _perform()
|
||||
|
||||
running = false
|
||||
event_finished.emit()
|
||||
|
||||
|
||||
func _perform() -> void:
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue