27 lines
513 B
GDScript
27 lines
513 B
GDScript
extends Node3D
|
|
|
|
@export var level_bounds : LevelBounds
|
|
|
|
var open = true
|
|
var active = true
|
|
|
|
@onready var anim_player: AnimationPlayer = $AnimationPlayer
|
|
|
|
|
|
func _on_player_detect_body_entered(body: Node3D) -> void:
|
|
if body is Player:
|
|
if open and active:
|
|
anim_player.play("close")
|
|
open = false
|
|
|
|
func _on_switch_1_switch_changed() -> void:
|
|
if open:
|
|
anim_player.play("close")
|
|
open = false
|
|
else:
|
|
anim_player.play("open")
|
|
open = true
|
|
|
|
if level_bounds != null:
|
|
level_bounds.toggle_collision(!open)
|