22 lines
678 B
GDScript
22 lines
678 B
GDScript
extends Area3D
|
|
|
|
@onready var animation_player = $"../FloorTrap/AnimationPlayer"
|
|
@onready var Player: CharacterBody3D = get_tree().get_first_node_in_group("Player")
|
|
@onready var collision: CollisionShape3D = $CollisionShape3D
|
|
|
|
var await_animation = false
|
|
|
|
##TODO Make this signal function not run every time the player enters the area
|
|
## or at least wait unit the return animation is done playing
|
|
|
|
func _on_body_entered(_body: Node3D) -> void:
|
|
if !await_animation:
|
|
animation_player.play("drop")
|
|
await_animation = true
|
|
await get_tree().create_timer(3, false).timeout
|
|
await_animation = false
|
|
|
|
|
|
func _on_body_exited(_body: Node3D) -> void:
|
|
animation_player.play("return")
|