ChronoChamber/Scripts/ChronoManager.gd

79 lines
1.7 KiB
GDScript3
Raw Normal View History

extends Node3D
# this is basically the level manager
signal broadcast(command : String)
@export_group("Variables")
@export var level_tick : float = 1 # how often to run a command
@export var level_time : float = 10 # the amoutn of time allowed for the level
2024-08-10 22:24:26 +10:00
var tick_timer : float = 0
var room_started : bool = false
var current_tick = 0
@export var pedestal_off_mat : Material
@export var pedestal_on_mat : Material
2024-08-10 17:20:39 +10:00
@export_group("Node References")
@export var gui : Control
2024-08-10 21:55:26 +10:00
@export var pedestals : Array[Pedestal]
# Called when the node enters the scene tree for the first time.
func _ready():
2024-08-10 22:24:26 +10:00
for i in pedestals.size():
pedestals[i].mesh.mesh = pedestals[i].mesh.mesh.duplicate()
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
2024-08-10 22:24:26 +10:00
if Input.is_action_just_pressed("debug_start"):
start_room()
if room_started and current_tick < level_time:
tick_timer += delta
if tick_timer > level_tick:
tick_timer = 0
current_tick += 1
print("Tick: " + str(current_tick))
for i in pedestals.size():
if i+1 == current_tick:
pedestals[i].mesh.mesh.material = pedestal_on_mat
else:
pass
#pedestals[i].mesh.material
pass
2024-08-10 21:55:26 +10:00
func start_room():
2024-08-10 22:24:26 +10:00
print("START")
room_started = true
# open door
# start timers
# start running commands
#hide crosshair
pass
func reset_room():
# run if timer expires, resets puzzle
2024-08-10 22:24:26 +10:00
# replace door
# put player back in start room
# reset timers
pass
func finish_room():
# called when player reaches exit
pass
func open_termimal():
gui.terminal_panel.visible = true
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
#display terminal ui
pass
2024-08-10 17:12:20 +10:00
func _on_player_object_clicked(object):
if(object.name == "Terminal"):
open_termimal()