feat: add way to skip to a step

This commit is contained in:
Kazhnuz 2021-07-17 22:59:12 +02:00
parent 627a7ea1e6
commit ed099bd77f
4 changed files with 34 additions and 0 deletions

View file

@ -12,6 +12,7 @@ return {
["jumpBack"] = {"duration", "blockProcess"},
["waitActorFinished"] = {"waitFor"},
["waitFor"] = {"waitFor"},
["skipTo"] = {"skipTo"},
["addQTE"] = {"qteData", "origin", "blockProcess"},
["useItemEffect"] = {},
--[name] = {args},

View file

@ -43,6 +43,26 @@ function ChoregraphySystem:update(dt)
end
end
function ChoregraphySystem:findTaggedAction(tag)
for stepId, step in ipairs(self.stepList) do
if (step[1] == "taggedAction") and (step[2] == tag) then
return stepId
end
end
return 0
end
function ChoregraphySystem:skipToStepByTag(tag)
self:skipToStep(self:findTaggedAction(tag))
end
function ChoregraphySystem:skipToStep(id)
if (self.stepList[id] ~= nil) then
self.currentStepId = id - 1
self:switchStep()
end
end
function ChoregraphySystem:switchStep()
if self:haveNextStep() then
self.currentStepId = self.currentStepId + 1

View file

@ -11,6 +11,7 @@ actions["sendDamage"] = require(baseURI .. "sendDamage")
actions["setAnimation"] = require(baseURI .. "setAnimation")
actions["wait"] = require(baseURI .. "wait")
actions["waitFor"] = require(baseURI .. "waitFor")
actions["skipTo"] = require(baseURI .. "skipTo")
actions["waitActorFinished"] = require(baseURI .. "waitActorFinished")
actions["useItemEffect"] = require(baseURI .. "useItemEffect")

View file

@ -0,0 +1,12 @@
local StepParent = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step.parent"
local SkipToStep = StepParent:extend()
function SkipToStep:new(system, args)
SkipToStep.super.new(self, system, args)
end
function SkipToStep:start()
self.choregraphy:skipToStepByTag(self.arguments.skipTo)
end
return SkipToStep