Files
escape/Scripts/lichtkastje.gd
T
2023-02-04 17:08:11 +01:00

30 lines
949 B
GDScript

extends Node3D
@onready var indirect_light = $"../IndirectLight"
@onready var dakraam = $"../Room/Dakraam"
@onready var light = $"../Light"
var dakraam_glas
func _ready():
if dakraam:
dakraam_glas = $"../Room/Dakraam".get_surface_override_material(0)
func _on_lock_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
if get_node("../Player").has_key:
$Deur.visible = false
$Lock.visible = false
func _on_lever_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
$Lever.rotation.z = $Lever.rotation.z + PI
if light != null:
light.visible = !light.visible
else:
indirect_light.visible = !indirect_light.visible
if indirect_light.visible:
dakraam.set_surface_override_material(0, dakraam_glas)
else:
dakraam.set_surface_override_material(0, null)