From 227b2bbf1e1e0024459aeb92dfcdde4ef8f87e71 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 31 Jul 2020 21:00:31 +0200 Subject: [PATCH] feat: add qte base --- .../fighters/systems/choregraphy/init.lua | 2 +- .../systems/choregraphy/qte/parent.lua | 72 +++++++++++++++++++ .../systems/choregraphy/qte/simplePrompt.lua | 0 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua create mode 100644 sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/simplePrompt.lua diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua index 9d47bb8..3eee591 100644 --- a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/init.lua @@ -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 diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua new file mode 100644 index 0000000..2fdefa7 --- /dev/null +++ b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/parent.lua @@ -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 diff --git a/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/simplePrompt.lua b/sonic-radiance.love/scenes/battlesystem/controllers/fighters/systems/choregraphy/qte/simplePrompt.lua new file mode 100644 index 0000000..e69de29