diff --git a/scenes/room/room_state.gd b/scenes/room/room_state.gd new file mode 100644 index 0000000..a868010 --- /dev/null +++ b/scenes/room/room_state.gd @@ -0,0 +1,48 @@ +class_name RoomState extends State + + +const STARTING = "Starting" +const PLAYING = "Playing" +const EXITING = "Exiting" + +var room: Room + + +func _ready() -> void: + await owner.ready + room = owner as Room + assert(room != null, "The RoomState state type must be used only in the room scene. It needs the owner's parent to be a Room node.") + + +func _enter(_previous_state_path: String, _data: Dictionary = {}) -> void: + pass + + +func _exit() -> void: + pass + + +func _handle_input(_event: InputEvent) -> void: + pass + + +func _state_update(_delta: float) -> void: + pass + + +func _state_physics_update(_delta: float) -> void: + pass + + +func match_state(exclude: Array[StringName] = []) -> StringName: + + return "" + + +func watch_state(exclude: Array[StringName] = [], data: Dictionary[StringName, Variant] = {}) -> bool: + var next_state: StringName = match_state(exclude) + if next_state != "": + finished.emit(next_state, data) + return true + + return false diff --git a/scenes/room/room_state.gd.uid b/scenes/room/room_state.gd.uid new file mode 100644 index 0000000..3bca291 --- /dev/null +++ b/scenes/room/room_state.gd.uid @@ -0,0 +1 @@ +uid://hjm43hb4os07