extends Node3D @onready var animation_player: AnimationPlayer = $AnimationPlayer @onready var animation_tree: AnimationTree = $AnimationTree ##动画状态机 @onready var state_machine: AnimationNodeStateMachinePlayback = animation_tree.get("parameters/StateMachine/playback") ##玩家是否移动 @onready var is_moving : bool = false : set(value): is_moving = value if is_moving: #animation_player.play("walking") state_machine.travel("walking") else : #animation_player.play("idle") state_machine.travel("idle")