18 lines
496 B
GDScript
18 lines
496 B
GDScript
extends StaticBody3D
|
|
|
|
@onready var Player: Node3D = get_tree().get_first_node_in_group("player")
|
|
@onready var player_ray: RayCast3D = get_tree().get_first_node_in_group("player_ray")
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
if has_node("InteractLabel"):
|
|
if player_ray.is_colliding() and player_ray.get_collider() == self:
|
|
$InteractLabel.show()
|
|
else:
|
|
$InteractLabel.hide()
|
|
|
|
func interact():
|
|
##Appends the key name to the keys array
|
|
Player.keys.append(self.name)
|
|
|
|
queue_free()
|