22 lines
618 B
Lua
22 lines
618 B
Lua
--- Умеет асинхронно ждать какое-то время (для анимаций)
|
|
--- @class ResidentSleeperBehavior : Behavior
|
|
--- @field animationNode? AnimationNode
|
|
local behavior = {}
|
|
behavior.__index = behavior
|
|
behavior.id = "residentsleeper"
|
|
|
|
function behavior.new() return setmetatable({}, behavior) end
|
|
|
|
function behavior:update(dt)
|
|
if not self.animationNode then return end
|
|
self.animationNode:update(dt)
|
|
end
|
|
|
|
--- @param node AnimationNode
|
|
function behavior:sleep(node)
|
|
if self.animationNode then self.animationNode:finish() end
|
|
self.animationNode = node
|
|
end
|
|
|
|
return behavior
|