SlimeoosOdyssey/godot/Models/grape_man.gd

38 lines
874 B
GDScript3
Raw Normal View History

2023-08-19 01:31:24 -06:00
extends Node3D
2023-08-19 14:49:36 -06:00
@onready var animation: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
2023-08-19 01:31:24 -06:00
signal anim_check_grab(position: Vector3)
var pickup_animation_in_progress = false
signal pickup_animation_finished
2023-08-19 14:49:36 -06:00
func idle_empty():
animation.travel("IdleEmpty")
func walk_empty():
animation.travel("WalkEmpty")
2023-08-19 01:31:24 -06:00
2023-08-19 14:49:36 -06:00
func walk_hold():
2023-08-19 01:31:24 -06:00
if pickup_animation_in_progress:
await pickup_animation_finished
2023-08-19 14:49:36 -06:00
animation.travel("WalkHold")
2023-08-19 01:31:24 -06:00
func pickup():
pickup_animation_in_progress = true
2023-08-19 14:49:36 -06:00
animation.travel("Pickup")
2023-08-19 01:31:24 -06:00
2023-08-19 14:49:36 -06:00
func idle_hold():
if pickup_animation_in_progress:
await pickup_animation_finished
animation.travel("IdleHold")
2023-08-19 01:31:24 -06:00
func animation_key_grab():
emit_signal("anim_check_grab", $GrabPointLocation.global_transform)
2023-08-19 14:49:36 -06:00
func animation_key_pickup_completed():
pickup_animation_in_progress = false
emit_signal("pickup_animation_finished")