Station Move handles disabled when not in build mode
This commit is contained in:
@@ -7,11 +7,16 @@ static var sides_in_play: Array[String]
|
||||
|
||||
enum GameState {
|
||||
RUNNING,
|
||||
GAME_OVER
|
||||
GAME_OVER,
|
||||
BUILDING
|
||||
}
|
||||
static var game_state: GameState = GameState.RUNNING
|
||||
static var game_state: GameState = GameState.RUNNING: set = _set_game_state
|
||||
|
||||
|
||||
static func _set_game_state(value: GameState):
|
||||
game_state = value
|
||||
Signals.game_state_changed.emit(value)
|
||||
|
||||
static func _restart():
|
||||
print("restart Game")
|
||||
game_state = GameState.RUNNING
|
||||
|
||||
@@ -2,3 +2,4 @@ extends Node
|
||||
|
||||
signal game_over
|
||||
signal restart_game
|
||||
signal game_state_changed(new_state: GameManager.GameState)
|
||||
@@ -5,6 +5,10 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
get_tree().quit()
|
||||
if event.is_action_pressed("satisfy_table_orders"):
|
||||
satisfy_table_orders()
|
||||
if event.is_action_pressed("set_building_mode"):
|
||||
set_buidling_mode()
|
||||
if event.is_action_pressed("set_running_mode"):
|
||||
set_running_mode()
|
||||
|
||||
|
||||
# Finds any node of class/type Table and calls satisfyAllOrders()
|
||||
@@ -17,4 +21,11 @@ func satisfy_table_orders() -> void:
|
||||
node.satisfyAllOrders()
|
||||
|
||||
|
||||
|
||||
func set_buidling_mode():
|
||||
print("Global key event: Setting building mode")
|
||||
GameManager.game_state = GameManager.GameState.BUILDING
|
||||
|
||||
|
||||
func set_running_mode():
|
||||
print("Global key event: Setting running mode")
|
||||
GameManager.game_state = GameManager.GameState.RUNNING
|
||||
|
||||
Reference in New Issue
Block a user