Free the robots
This commit is contained in:
parent
710ae4268f
commit
67820a291c
1 changed files with 7 additions and 2 deletions
|
|
@ -20,10 +20,10 @@ func _ready() -> void:
|
||||||
_wall_display.modulate = WALL_DISPLAY_COLOR
|
_wall_display.modulate = WALL_DISPLAY_COLOR
|
||||||
_wall_display.text = str(_current_floor)
|
_wall_display.text = str(_current_floor)
|
||||||
EventBus.doors_closed.connect(_on_doors_closed)
|
EventBus.doors_closed.connect(_on_doors_closed)
|
||||||
EventBus.doors_fully_closed.connect(_free_robot)
|
EventBus.doors_fully_closed.connect(_free_robot_unless_winning)
|
||||||
EventBus.doors_opened.connect(_on_doors_opened)
|
EventBus.doors_opened.connect(_on_doors_opened)
|
||||||
EventBus.floor_changed.connect(_on_floor_changed)
|
EventBus.floor_changed.connect(_on_floor_changed)
|
||||||
EventBus.game_lost.connect(func(_reason: String): _free_robot())
|
EventBus.game_lost.connect(func(_reason: String): _free_robot_unless_winning())
|
||||||
EventBus.game_won.connect(_free_robot)
|
EventBus.game_won.connect(_free_robot)
|
||||||
|
|
||||||
func _collect_dim_targets() -> void:
|
func _collect_dim_targets() -> void:
|
||||||
|
|
@ -62,6 +62,11 @@ func _free_robot() -> void:
|
||||||
_robot.queue_free()
|
_robot.queue_free()
|
||||||
_robot = null
|
_robot = null
|
||||||
|
|
||||||
|
func _free_robot_unless_winning() -> void:
|
||||||
|
if is_instance_valid(_robot) and _robot.robot_win:
|
||||||
|
return
|
||||||
|
_free_robot()
|
||||||
|
|
||||||
func _on_floor_changed(new_floor: int) -> void:
|
func _on_floor_changed(new_floor: int) -> void:
|
||||||
_current_floor = new_floor
|
_current_floor = new_floor
|
||||||
_wall_display.text = str(new_floor)
|
_wall_display.text = str(new_floor)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue