Skip to content

Instantly share code, notes, and snippets.

@dinodeck
Created August 11, 2016 09:15
Show Gist options
  • Save dinodeck/355a7bcaa62b3121a1206f7bdd33f4d5 to your computer and use it in GitHub Desktop.
Save dinodeck/355a7bcaa62b3121a1206f7bdd33f4d5 to your computer and use it in GitHub Desktop.
TimedTextboxEvent that let's waits for textboxes being dismissed and let's the user cancel them
TimedTextboxEvent = {}
TimedTextboxEvent.__index = TimedTextboxEvent
function TimedTextboxEvent:Create(box, time)
local this =
{
mTextbox = box,
mCountDown = time
}
setmetatable(this, self)
return this
end
function TimedTextboxEvent:Update(dt, storyboard)
self.mCountDown = self.mCountDown - dt
if self.mCountDown <= 0 then
self.mTextbox:OnClick()
end
end
function TimedTextboxEvent:Render() end
function TimedTextboxEvent:IsBlocking()
return self.mCountDown > 0 or
not self.mTextbox:IsDead()
end
function TimedTextboxEvent:IsFinished()
return self.mTextbox:IsDead() or
not self:IsBlocking()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment