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
