Skip to main content

playActorAnimation 播放角色动画

playActorAnimation

类型: MethodDeclaration

所属类: CommandFunctionList

定义位置: command.ts

描述

播放角色动画

参数

参数名类型描述默认值
\{actor, motion, speed, wait\}`{
actor: ActorGetter
motion: string
speed: number | VariableGetter
wait: boolean
}`--

返回值

类型: CommandFunction

源代码

位置: 第 6330 行

protected playActorAnimation({actor, motion, speed, wait}: {
actor: ActorGetter
motion: string
speed: number | VariableGetter
wait: boolean
}): CommandFunction {
const getActor = Command.compileActor(actor)
const getSpeed = Command.compileNumber(speed, 1, 0.1, 10)
const motionName = Enum.getValue(motion)
return () => {
const actor = getActor()
if (actor) {
const animation = actor.animationController.playMotion(motionName, getSpeed())
if (wait && animation) {
const event = CurrentEvent
animation.onFinish(() => {
event.continue()
})
return CurrentEvent.pause()
}
}
return true
}
}

文档生成时间:2025/7/7 12:07:06