PGRData/Script/matrix/xrestaurant/xnode/XRestaurantDoActionOnlyNode.lua
2024-09-01 22:49:41 +02:00

27 lines
No EOL
945 B
Lua

---@class XRestaurantDoActionOnlyNode : XLuaBehaviorNode
---@field AgentProxy XRestaurantCharAgent
local XRestaurantDoActionOnlyNode = XLuaBehaviorManager.RegisterNode(XLuaBehaviorNode,
"RestaurantDoActionOnly", CsBehaviorNodeType.Action, true, false)
function XRestaurantDoActionOnlyNode:OnAwake()
if self.Fields == nil then
self.Node.Status = CsNodeStatus.ERROR
return
end
if self.Fields["ActionId"] == nil or self.Fields["NeedFadeCross"] == nil or self.Fields["CrossDuration"] == nil then
self.Node.Status = CsNodeStatus.ERROR
return
end
self.ActionId = self.Fields["ActionId"]
self.NeedFadeCross = self.Fields["NeedFadeCross"]
self.CrossDuration = self.Fields["CrossDuration"]
end
function XRestaurantDoActionOnlyNode:OnEnter()
self.AgentProxy:DoAction(self.ActionId, self.NeedFadeCross, self.CrossDuration)
self.Node.Status = CsNodeStatus.SUCCESS
end