Files
escape/Scripts/Safe.gd
T
mark 9b7b25ff94 Various updates
Flashlight, fog, letter shader, safe audio
2023-01-31 19:11:38 +01:00

54 lines
1.6 KiB
GDScript

extends Node3D
var sequence
var sequence_guess = []
var i = 0
func _ready():
sequence = $".."/Painting.sequence
var bmat = StandardMaterial3D.new()
bmat.emission_enabled = true
bmat.albedo_color = Color.LIGHT_SLATE_GRAY
bmat.emission = Color.LIGHT_BLUE
bmat.emission_intensity = 0.05
$ButtonUp.set_surface_override_material(0, bmat)
$ButtonLeft.set_surface_override_material(0, bmat)
$ButtonDown.set_surface_override_material(0, bmat)
$ButtonRight.set_surface_override_material(0, bmat)
func add_sequence_guess(dir):
if sequence[i] == dir:
$Button.playing = true
i += 1
if (i == sequence.size()):
$Door.visible = false
$ButtonUp.visible = false
$ButtonDown.visible = false
$ButtonLeft.visible = false
$ButtonRight.visible = false
i = 0
else:
$Reset.playing = true
i = 0
func _on_up_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
add_sequence_guess(0)
func _on_left_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
add_sequence_guess(3)
func _on_down_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
add_sequence_guess(2)
func _on_right_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
add_sequence_guess(1)
func _on_flash_light_input_event(camera, event, position, normal, shape_idx):
if event is InputEventMouseButton and event.is_action_pressed("interact"):
$FlashLight.visible = false