allow AnimationNode to not have its own animation
This commit is contained in:
parent
77e723c4bb
commit
f790a4dcf8
@ -30,11 +30,13 @@ function animation:chain(children)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param data {[1]: animationRunner, onEnd?: voidCallback, children?: AnimationNode[]}
|
--- @param data {[1]: animationRunner?, onEnd?: voidCallback, children?: AnimationNode[]}
|
||||||
--- @return AnimationNode
|
--- @return AnimationNode
|
||||||
local function new(data)
|
local function new(data)
|
||||||
local t = setmetatable({}, animation)
|
local t = setmetatable({}, animation)
|
||||||
t.run = data[1]
|
t.run = data[1] or function(self)
|
||||||
|
self:finish()
|
||||||
|
end
|
||||||
t.onEnd = data.onEnd
|
t.onEnd = data.onEnd
|
||||||
t.count = 1 -- своя анимация
|
t.count = 1 -- своя анимация
|
||||||
t.children = {}
|
t.children = {}
|
||||||
|
|||||||
@ -115,9 +115,6 @@ function attack:cast(caster, target)
|
|||||||
if not sprite or not targetSprite then return true end
|
if not sprite or not targetSprite then return true end
|
||||||
|
|
||||||
AnimationNode {
|
AnimationNode {
|
||||||
function(node)
|
|
||||||
caster:has(Tree.behaviors.residentsleeper):sleep(0, node)
|
|
||||||
end,
|
|
||||||
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,
|
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,
|
||||||
children = {
|
children = {
|
||||||
AnimationNode {
|
AnimationNode {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user