This repository has been archived on 2024-09-30. You can view files and clone it, but cannot push or open issues/pull-requests.
2024-09-15 17:51:07 +03:00
|
|
|
class_name PuzzleManager
|
|
|
|
extends Node
|
|
|
|
|
|
|
|
signal finish_room
|
|
|
|
|
|
|
|
@export var mandatory_puzzles: Array[Puzzle]
|
|
|
|
@export var optional_puzzles: Array[Puzzle]
|
|
|
|
|
2024-09-20 22:50:26 +03:00
|
|
|
var mark_as_finished = false
|
|
|
|
|
2024-09-15 17:51:07 +03:00
|
|
|
func _process(delta):
|
2024-09-20 22:50:26 +03:00
|
|
|
check_is_room_finished()
|
2024-09-15 17:51:07 +03:00
|
|
|
pass
|
|
|
|
|
2024-09-20 22:50:26 +03:00
|
|
|
func check_is_room_finished() -> bool:
|
|
|
|
if mark_as_finished:
|
|
|
|
return true
|
|
|
|
|
2024-09-15 17:51:07 +03:00
|
|
|
for puzzle in mandatory_puzzles:
|
|
|
|
if !puzzle.is_complete:
|
|
|
|
return false
|
2024-09-20 22:50:26 +03:00
|
|
|
|
|
|
|
finish_room.emit()
|
|
|
|
mark_as_finished = true
|
2024-09-15 17:51:07 +03:00
|
|
|
return true
|