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/grave_puzzle.gd

37 lines
646 B
GDScript

class_name GravePuzzle
extends Puzzle
@onready var timer: Timer = $Timer
@export var graves: Array[Grave] = []
var _last_grave: Grave
func _process(delta):
var is_finished = true
for grave in graves:
if !grave.is_finished:
is_finished = false
break;
if !is_complete and is_finished:
# In case we forget or don't need to add a timer for some rooms
if timer and timer.is_stopped():
timer.start()
elif !timer:
complete()
func activate_grave(grave: Grave):
if _last_grave == grave.pair:
grave.complete()
grave.pair.complete()
return
grave.sing()
_last_grave = grave
func _on_timer_timeout():
complete()