feat: add basic qte framework
This commit is contained in:
parent
e26597c10a
commit
b95ad72dcb
8 changed files with 104 additions and 2 deletions
|
@ -14,6 +14,8 @@ return {
|
||||||
choregraphy = { -- the main attack choregraphy
|
choregraphy = { -- the main attack choregraphy
|
||||||
{"setAnimation", "none", "walk", false},
|
{"setAnimation", "none", "walk", false},
|
||||||
{'goTo', "none", "target", -1, 0, 0.3, true},
|
{'goTo', "none", "target", -1, 0, 0.3, true},
|
||||||
|
|
||||||
|
{"addQTE", "none", {"simplePrompt", "A", 0.2}, "target", false},
|
||||||
{'playSFX', "none", 'hit'},
|
{'playSFX', "none", 'hit'},
|
||||||
{'setAnimation', "none", 'hit1start', true},
|
{'setAnimation', "none", 'hit1start', true},
|
||||||
{'sendDamage', "none", 33, 100, false, false},
|
{'sendDamage', "none", 33, 100, false, false},
|
||||||
|
@ -21,6 +23,7 @@ return {
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'setAnimation', "none", 'hit1end', true},
|
{'setAnimation', "none", 'hit1end', true},
|
||||||
|
|
||||||
|
{"addQTE", "none", {"simplePrompt", "A", 0.2}, "target", false},
|
||||||
{'playSFX', "none", 'hit'},
|
{'playSFX', "none", 'hit'},
|
||||||
{'setAnimation', "none", 'hit2start', true},
|
{'setAnimation', "none", 'hit2start', true},
|
||||||
{'sendDamage', "none", 33, 100, false, false},
|
{'sendDamage', "none", 33, 100, false, false},
|
||||||
|
@ -28,6 +31,7 @@ return {
|
||||||
{'playSFX', "sentDamage", 'hitconnect'},
|
{'playSFX', "sentDamage", 'hitconnect'},
|
||||||
{'setAnimation', "none", 'hit2end', true},
|
{'setAnimation', "none", 'hit2end', true},
|
||||||
|
|
||||||
|
{"addQTE", "none", {"simplePrompt", "A", 0.2}, "target", false},
|
||||||
{'playSFX', "none", 'hit'},
|
{'playSFX', "none", 'hit'},
|
||||||
{'setAnimation', "none", 'hit3start', true},
|
{'setAnimation', "none", 'hit3start', true},
|
||||||
{'sendDamage', "none", 33, 100, false, false},
|
{'sendDamage', "none", 33, 100, false, false},
|
||||||
|
|
|
@ -9,6 +9,7 @@ return {
|
||||||
["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"},
|
["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"},
|
||||||
["jumpBack"] = {"duration", "blockProcess"},
|
["jumpBack"] = {"duration", "blockProcess"},
|
||||||
["waitActorFinished"] = {"waitFor"},
|
["waitActorFinished"] = {"waitFor"},
|
||||||
|
["addQTE"] = {"qteData", "origin", "blockProcess"}
|
||||||
--[name] = {args},
|
--[name] = {args},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
ChoregraphyUtils = {}
|
ChoregraphyUtils = {}
|
||||||
|
|
||||||
|
-- steps utils
|
||||||
|
|
||||||
function ChoregraphyUtils.getStepStructure(stepName)
|
function ChoregraphyUtils.getStepStructure(stepName)
|
||||||
local stepTypeList = require "game.utils.choregraphy.arguments"
|
local stepTypeList = require "game.utils.choregraphy.arguments"
|
||||||
return stepTypeList[stepName]
|
return stepTypeList[stepName]
|
||||||
|
@ -9,7 +11,7 @@ function ChoregraphyUtils.stepExists(stepName)
|
||||||
return (ChoregraphyUtils.getStepStructure(stepName) ~= nil)
|
return (ChoregraphyUtils.getStepStructure(stepName) ~= nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChoregraphyUtils.validate(stepBaseDatas)
|
function ChoregraphyUtils.validateStep(stepBaseDatas)
|
||||||
local structure = ChoregraphyUtils.getStepStructure(stepBaseDatas[1])
|
local structure = ChoregraphyUtils.getStepStructure(stepBaseDatas[1])
|
||||||
if (structure == nil) then
|
if (structure == nil) then
|
||||||
return false
|
return false
|
||||||
|
@ -23,7 +25,7 @@ function ChoregraphyUtils.getStepDatas(stepBaseDatas)
|
||||||
local stepData = {}
|
local stepData = {}
|
||||||
stepData.name = stepBaseDatas[1]
|
stepData.name = stepBaseDatas[1]
|
||||||
|
|
||||||
if (ChoregraphyUtils.validate(stepBaseDatas)) then
|
if (ChoregraphyUtils.validateStep(stepBaseDatas)) then
|
||||||
stepData.condition = stepBaseDatas[2]
|
stepData.condition = stepBaseDatas[2]
|
||||||
|
|
||||||
local structure = ChoregraphyUtils.getStepStructure(stepData.name)
|
local structure = ChoregraphyUtils.getStepStructure(stepData.name)
|
||||||
|
@ -42,4 +44,46 @@ function ChoregraphyUtils.getStepDatas(stepBaseDatas)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- QTE utils
|
||||||
|
|
||||||
|
function ChoregraphyUtils.getQteStructure(qteName)
|
||||||
|
local stepTypeList = require "game.utils.choregraphy.qte"
|
||||||
|
return stepTypeList[qteName]
|
||||||
|
end
|
||||||
|
|
||||||
|
function ChoregraphyUtils.qteExists(qteName)
|
||||||
|
return (ChoregraphyUtils.getQteStructure(qteName) ~= nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ChoregraphyUtils.validateQte(qteBaseDatas)
|
||||||
|
local structure = ChoregraphyUtils.getQteStructure(qteBaseDatas[1])
|
||||||
|
if (structure == nil) then
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
return ((#structure + 1) == #qteBaseDatas)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ChoregraphyUtils.getQteDatas(qteBaseDatas)
|
||||||
|
|
||||||
|
local qteData = {}
|
||||||
|
qteData.name = qteBaseDatas[1]
|
||||||
|
|
||||||
|
if (ChoregraphyUtils.validateQte(qteBaseDatas)) then
|
||||||
|
local structure = ChoregraphyUtils.getQteStructure(qteData.name)
|
||||||
|
|
||||||
|
qteData.arguments = {}
|
||||||
|
|
||||||
|
for i, argumentName in ipairs(structure) do
|
||||||
|
local argumentContent = qteBaseDatas[i + 1]
|
||||||
|
qteData.arguments[argumentName] = argumentContent
|
||||||
|
end
|
||||||
|
|
||||||
|
return qteData
|
||||||
|
else
|
||||||
|
error("Le QTE " .. qteData.name .. " à un nbr d'argument incorrect")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
return ChoregraphyUtils
|
return ChoregraphyUtils
|
||||||
|
|
3
sonic-radiance.love/game/utils/choregraphy/qte.lua
Normal file
3
sonic-radiance.love/game/utils/choregraphy/qte.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
return {
|
||||||
|
["simplePrompt"] = {"key", "duration"}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ local ChoregraphySystem = Object:extend()
|
||||||
|
|
||||||
local choregraphyUtils = require "game.utils.choregraphy"
|
local choregraphyUtils = require "game.utils.choregraphy"
|
||||||
local stepObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step"
|
local stepObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step"
|
||||||
|
local qteObjectList = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.qte"
|
||||||
|
|
||||||
function ChoregraphySystem:new(action, choregraphy)
|
function ChoregraphySystem:new(action, choregraphy)
|
||||||
self.action = action
|
self.action = action
|
||||||
|
@ -14,9 +15,17 @@ function ChoregraphySystem:new(action, choregraphy)
|
||||||
self.currentStepId = 0
|
self.currentStepId = 0
|
||||||
self.currentStep = nil
|
self.currentStep = nil
|
||||||
self.stepList = choregraphy
|
self.stepList = choregraphy
|
||||||
|
|
||||||
|
self.qte = {}
|
||||||
|
self.qte.current = nil
|
||||||
|
self.qte.wasSuccess = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function ChoregraphySystem:update(dt)
|
function ChoregraphySystem:update(dt)
|
||||||
|
if (self.qte.current ~= nil) then
|
||||||
|
self.qte.current:update(dt)
|
||||||
|
end
|
||||||
|
|
||||||
if (self.currentStep ~= nil) then
|
if (self.currentStep ~= nil) then
|
||||||
self.currentStep:updateStep(dt)
|
self.currentStep:updateStep(dt)
|
||||||
else
|
else
|
||||||
|
@ -37,6 +46,15 @@ function ChoregraphySystem:switchStep()
|
||||||
end
|
end
|
||||||
end
|
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:blockAction(action, blockProcess)
|
||||||
|
self.qte.current:setOrigin(origin)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial)
|
function ChoregraphySystem:sendDamage(power, accuracy, isSpecial, isAerial)
|
||||||
if (self.target ~= nil) then
|
if (self.target ~= nil) then
|
||||||
if (self.fighter.isAlive) then
|
if (self.fighter.isAlive) then
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
local qtes = {}
|
||||||
|
|
||||||
|
local baseURI = "scenes.battlesystem.controllers.fighters.systems.choregraphy.qte."
|
||||||
|
|
||||||
|
return qtes
|
|
@ -0,0 +1,26 @@
|
||||||
|
local StepParent = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step.parent"
|
||||||
|
local StepQTE = StepParent:extend()
|
||||||
|
|
||||||
|
function StepQTE:new(controller, args)
|
||||||
|
StepQTE.super.new(self, controller, args)
|
||||||
|
end
|
||||||
|
|
||||||
|
function StepQTE:start()
|
||||||
|
self.choregraphy:addQTE(self, self.arguments.origin, self.arguments.qteData, self.arguments.blockProcess)
|
||||||
|
if (not self.arguments.blockProcess) then
|
||||||
|
self:finish()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function StepQTE:update(dt)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function StepQTE:getSignal(signal)
|
||||||
|
if (signal == "gfxEnded") then
|
||||||
|
self:finish()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return StepQTE
|
|
@ -3,6 +3,7 @@ local actions = {}
|
||||||
local baseURI = "scenes.battlesystem.controllers.fighters.systems.choregraphy.step."
|
local baseURI = "scenes.battlesystem.controllers.fighters.systems.choregraphy.step."
|
||||||
|
|
||||||
actions["addGFX"] = require(baseURI .. "addGFX")
|
actions["addGFX"] = require(baseURI .. "addGFX")
|
||||||
|
actions["addQTE"] = require(baseURI .. "addQTE")
|
||||||
actions["goTo"] = require(baseURI .. "goTo")
|
actions["goTo"] = require(baseURI .. "goTo")
|
||||||
actions["jumpBack"] = require(baseURI .. "jumpBack")
|
actions["jumpBack"] = require(baseURI .. "jumpBack")
|
||||||
actions["playSFX"] = require(baseURI .. "playSFX")
|
actions["playSFX"] = require(baseURI .. "playSFX")
|
||||||
|
|
Loading…
Reference in a new issue