summaryrefslogtreecommitdiff
path: root/Game/States/StateManager.gd
blob: 5a176e2ebe3c9afacd4017b137bc3fa0897dcb04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class_name StateManager
extends Node


func _ready():
	Client.state = get_child(0)


func _input(event: InputEvent) -> void:
	Client.state._state_input(event)


func _unhandled_input(event: InputEvent) -> void:
	Client.state._state_unhandled_input(event)


func set_state(state: Variant):
	if state is not State:
		state = get_node(state)
	
	Client.state._state_exit()
	Client.state = state
	Client.state._state_enter()