46 lines
1.1 KiB
GDScript
46 lines
1.1 KiB
GDScript
extends Node3D
|
|
|
|
var upper_body_animation: AnimationPlayer
|
|
var full_body_animation: AnimationPlayer
|
|
|
|
|
|
signal anim_check_grab(position: Vector3)
|
|
|
|
var pickup_animation_in_progress = false
|
|
signal pickup_animation_finished
|
|
|
|
func _ready():
|
|
upper_body_animation = $AnimationPlayer.duplicate()
|
|
add_child(upper_body_animation)
|
|
full_body_animation = $AnimationPlayer
|
|
full_body_animation.play("Idle")
|
|
upper_body_animation.play("UpperBodyIdle")
|
|
|
|
func hold():
|
|
if pickup_animation_in_progress:
|
|
await pickup_animation_finished
|
|
upper_body_animation.play("UpperBodyHolding")
|
|
|
|
func pickup():
|
|
pickup_animation_in_progress = true
|
|
full_body_animation.play("Pickup")
|
|
await full_body_animation.animation_finished
|
|
full_body_animation.play("Idle")
|
|
upper_body_animation.play("UpperBodyIdle")
|
|
pickup_animation_in_progress = false
|
|
emit_signal("pickup_animation_finished")
|
|
|
|
func idle():
|
|
full_body_animation.play("Idle")
|
|
|
|
func drop():
|
|
full_body_animation.play("Idle")
|
|
upper_body_animation.play("UpperBodyIdle")
|
|
|
|
|
|
func walk():
|
|
full_body_animation.play("Walk")
|
|
|
|
func animation_key_grab():
|
|
emit_signal("anim_check_grab", $GrabPointLocation.global_transform)
|