feat: add qte base

This commit is contained in:
Kazhnuz 2020-07-31 21:00:31 +02:00
parent b95ad72dcb
commit 227b2bbf1e
3 changed files with 73 additions and 1 deletions

View file

@ -49,7 +49,7 @@ end
function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess)
local qteData = choregraphyUtils.getQteDatas(qteBaseData)
if (qteObjectList[qteData.name] ~= nil) then
self.qte.current = qteObjectList[qteData.name](self, qteData.arguments, action)
self.qte.current = qteObjectList[qteData.name](self, qteData.arguments)
self.qte.current:blockAction(action, blockProcess)
self.qte.current:setOrigin(origin)
end

View file

@ -0,0 +1,72 @@
local QteParent = Object:extend()
function QteParent:new(choregraphySystem, arguments)
self.choregraphy = choregraphySystem
self.arguments = arguments
self.timer = 0
self.origin = nil
self.isBlocking = nil
end
function QteParent:blockAction(action, blockProcess)
if (blockProcess) then
self.isBlocking = action
end
end
function QteParent:setOrigin(origin)
self.origin = origin
end
function QteParent:drawButton(x, y, letter)
local grayValue = .44
local darkValue = .11
love.graphics.setColor(grayValue, grayValue, grayValue, 1)
love.graphics.circle("fill", x, y, 8, 8)
love.graphics.setColor(darkValue, darkValue, darkValue, 1)
love.graphics.circle("line", x, y, 8, 8)
love.graphics.print(letter, x, y)
utils.graphics.resetColor()
end
function StepParent:updateStep(dt)
if (not self.isStarted) then
self:start()
self.isStarted = true
else
self:update(dt)
self:updateTimer(dt)
end
end
function StepParent:update(dt)
--
end
function StepParent:updateTimer(dt)
if (self.arguments.duration ~= nil) then
self.timer = self.timer + dt
if (self.timer > self.arguments.duration) then
self:fail()
end
end
end
function QteParent:succes()
self:finish(true)
end
function QteParent:fail()
self:finish(false)
end
function QteParent:finish(success)
print("action finished")
self.choregraphy:endQte(success)
if (self.isBlocking ~= nil) then
self.isBlocking:finish()
end
end
return QteParent