This repository has been archived on 2024-09-30. You can view files and clone it, but cannot push or open issues/pull-requests.
gbjam12/puzzles/room_manager/room_manager.gd

26 lines
446 B
GDScript
Raw Permalink Normal View History

class_name PuzzleManager
extends Node
signal finish_room
@export var mandatory_puzzles: Array[Puzzle]
@export var optional_puzzles: Array[Puzzle]
var mark_as_finished = false
func _process(delta):
check_is_room_finished()
pass
func check_is_room_finished() -> bool:
if mark_as_finished:
return true
for puzzle in mandatory_puzzles:
if !puzzle.is_complete:
return false
finish_room.emit()
mark_as_finished = true
return true