Created
August 11, 2016 09:15
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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