feat(assets/animator): handle sending callbacks when animation end

This commit is contained in:
Kazhnuz 2019-09-07 20:52:20 +02:00
parent f61f529302
commit 76fb15f862

View file

@ -120,6 +120,20 @@ function Animator:getDimensions()
return self.sprite:getDimensions()
end
-- CALLBACK FUNCTIONS
-- Handle getting a calback from the animation system
function Animator:setCallbackTarget(callbackTarget)
self.callbackTarget = callbackTarget
end
function Animator:sendCallback()
if (self.callbackTarget ~= nil) then
if (self.callbackTarget.animationEnded ~= nil) then
self.callbackTarget:animationEnded(self.currentAnimation)
end
end
end
-- DRAW FUNCTIONS
-- Draw animations using these functions