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
1 changed files with 14 additions and 0 deletions

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