24 lines
553 B
GDScript
24 lines
553 B
GDScript
extends Node
|
|
|
|
signal room_entered()
|
|
signal room_exited()
|
|
|
|
@export var one_way = false
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
add_to_group("room_check")
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
func _on_body_entered(body: Node3D) -> void:
|
|
if body.is_in_group("player"):
|
|
get_parent().room_entered()
|
|
|
|
func _on_body_exited(body: Node3D) -> void:
|
|
if !one_way:
|
|
if body.is_in_group("player"):
|
|
get_parent().room_exited()
|