fix: remove input lag from QTE

This commit is contained in:
Kazhnuz 2021-07-18 18:26:15 +02:00
parent 6626dbebdf
commit 26ba64218b
2 changed files with 14 additions and 5 deletions

View file

@ -26,6 +26,7 @@ function ChoregraphySystem:new(action, choregraphy)
self.qte = {}
self.qte.current = nil
self.qte.wasSuccess = false
self.qte.isActive = false
self.qte.list = {}
self.finishedTagActions = {}
@ -34,7 +35,7 @@ end
function ChoregraphySystem:update(dt)
if (self.qte.current ~= nil) then
self.qte.current:updateQte(dt)
self.qte.current:updateQte(dt, self.qte.isActive)
end
if (self.currentStep ~= nil) then
@ -104,6 +105,7 @@ function ChoregraphySystem:addQTE(action, origin, qteBaseData, blockProcess, tag
self.qte.current:blockAction(action, blockProcess)
self.qte.current:setOrigin(origin)
self.qte.current:setTag(tag)
self.qte.isActive = true
end
end
@ -113,12 +115,16 @@ function ChoregraphySystem:isQteSuccess(qteID)
end
function ChoregraphySystem:endQte(success)
self.qte.current = nil
self.qte.isActive = false
self.qte.wasSuccess = success
table.insert(self.qte.list, success)
end
function ChoregraphySystem:removeQte()
self.qte.current = nil
end
function ChoregraphySystem:testTagAction(tag, statut)
local tagStatut = self.finishedTagActions[tag] or 0
return (statut <= tagStatut)

View file

@ -60,7 +60,7 @@ function QteParent:setOrigin(origin)
end
end
function QteParent:updateQte(dt)
function QteParent:updateQte(dt, isActive)
if (not self.isStarted) then
self:start()
self.isStarted = true
@ -68,7 +68,9 @@ function QteParent:updateQte(dt)
self:update(dt)
self.tweens:update(dt)
self.prompts:update(dt)
self:verifyPrompts()
if (isActive) then
self:verifyPrompts()
end
end
end
@ -84,7 +86,7 @@ function QteParent:timerResponse(timer)
self.timerActive = true
self.prompts.defaultTimerValue = 0
elseif (timer == "endQte") then
self:endQte()
self.choregraphy:removeQte()
end
end
@ -92,6 +94,7 @@ function QteParent:finish(success)
self.isSuccess = success
self.timerActive = false
self.tweens:newTimer(self.prompts.BEGINTIME, "endQte")
self:endQte()
end
function QteParent:verifyPrompts()