PGRData/Script/matrix/xguide/node/XGuideIsAnimPlayingNode.lua

25 lines
832 B
Lua
Raw Normal View History

2024-09-01 20:49:41 +00:00
---@class XGuideIsAnimPlayingNode : XLuaBehaviorNode
---@field AgentProxy XGuideAgent
local XGuideIsAnimPlayingNode = XLuaBehaviorManager.RegisterNode(XLuaBehaviorNode, "IsAnimPlaying", CsBehaviorNodeType.Condition, true, false)
function XGuideIsAnimPlayingNode:OnAwake()
if self.Fields == nil then
self.Node.Status = CsNodeStatus.ERROR
return
end
if self.Fields["UiName"] == nil or self.Fields["AnimName"] == nil then
self.Node.Status = CsNodeStatus.ERROR
return
end
self.UiName = self.Fields["UiName"]
self.AnimName = self.Fields["AnimName"]
end
function XGuideIsAnimPlayingNode:OnEnter()
local status = self.AgentProxy:CheckAnimIsPlaying(self.UiName, self.AnimName)
and CsNodeStatus.SUCCESS or CsNodeStatus.FAILED
self.Node.Status = status
end