feat(choregraphy): add new 3D-based steps

This commit is contained in:
Kazhnuz 2021-07-18 14:08:07 +02:00
parent 99380cc74e
commit c121a35f90
5 changed files with 67 additions and 8 deletions

View file

@ -6,8 +6,9 @@ return {
["playSFX"] = {"sfx"}, ["playSFX"] = {"sfx"},
["sendDamage"] = {"power", "type", "element", "isSpecial"}, ["sendDamage"] = {"power", "type", "element", "isSpecial"},
["goTo"] = {"origin", "x", "y", "duration", "blockProcess"}, ["goTo"] = {"origin", "x", "y", "duration", "blockProcess"},
["goTo3D"] = {"origin", "x", "y", "z", "duration", "blockProcess"},
["setAnimation"] = {"animation", "blockProcess"}, ["setAnimation"] = {"animation", "blockProcess"},
["jump"] = {"power", "bounceNumber", "blockProcess"}, ["jump"] = {"power", "useDefaultAnimation", "blockProcess"},
["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"}, ["jumpTo"] = {"origin", "x", "y", "duration", "blockProcess"},
["jumpBack"] = {"height", "speed", "blockProcess"}, ["jumpBack"] = {"height", "speed", "blockProcess"},
["waitActorFinished"] = {"waitFor"}, ["waitActorFinished"] = {"waitFor"},

View file

@ -0,0 +1,29 @@
local StepParent = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step.parent"
local GoTo3DStep = StepParent:extend()
function GoTo3DStep:new(controller, args)
GoTo3DStep.super.new(self, controller, args, true)
end
function GoTo3DStep:start()
local x, y, z = self:getStepCoordinate()
self.choregraphy.actor:goTo3D(x, y, z, self.arguments.duration)
self.choregraphy.actor:addTaggedAction(self.tag, self.choregraphy, "goTo")
if (self.arguments.blockProcess == false) then
self:finish()
else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "goTo")
end
end
function GoTo3DStep:update(dt)
end
function GoTo3DStep:getSignal(signal)
end
return GoTo3DStep;

View file

@ -5,7 +5,9 @@ local baseURI = "scenes.battlesystem.controllers.fighters.systems.choregraphy.st
actions["addGFX"] = require(baseURI .. "addGFX") actions["addGFX"] = require(baseURI .. "addGFX")
actions["addQTE"] = require(baseURI .. "addQTE") actions["addQTE"] = require(baseURI .. "addQTE")
actions["goTo"] = require(baseURI .. "goTo") actions["goTo"] = require(baseURI .. "goTo")
actions["goTo3D"] = require(baseURI .. "goTo3D")
actions["jumpBack"] = require(baseURI .. "jumpBack") actions["jumpBack"] = require(baseURI .. "jumpBack")
actions["jump"] = require(baseURI .. "jump")
actions["playSFX"] = require(baseURI .. "playSFX") actions["playSFX"] = require(baseURI .. "playSFX")
actions["sendDamage"] = require(baseURI .. "sendDamage") actions["sendDamage"] = require(baseURI .. "sendDamage")
actions["setAnimation"] = require(baseURI .. "setAnimation") actions["setAnimation"] = require(baseURI .. "setAnimation")

View file

@ -0,0 +1,27 @@
local StepParent = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step.parent"
local JumpStep = StepParent:extend()
function JumpStep:new(controller, args)
JumpStep.super.new(self, controller, args, true)
end
function JumpStep:start()
self.choregraphy.actor:setJump(self.arguments.power, 0, self.arguments.useDefaultAnimation)
self.choregraphy.actor:addTaggedAction(self.tag, self.choregraphy, "jump")
if (self.arguments.blockProcess == false) then
self:finish()
else
self.choregraphy.actor:blockChoregraphy(self.arguments.blockProcess, self, "jump")
end
end
function JumpStep:update(dt)
end
function JumpStep:getSignal(signal)
end
return JumpStep;

View file

@ -25,18 +25,18 @@ function StepParent:updateStep(dt)
end end
function StepParent:getStepCoordinate() function StepParent:getStepCoordinate()
local argx, argy = self.arguments.x, self.arguments.y local argx, argy, argz = self.arguments.x, self.arguments.y, self.arguments.z or 0
argx = argx * self.choregraphy.actor.start.direction argx = argx * self.choregraphy.actor.start.direction
if (self.arguments.origin == "target") then if (self.arguments.origin == "target") then
local target = self.choregraphy.action.target local target = self.choregraphy.action.target
local x, y = target.actor:getCoordinate() local x, y, z = target.actor:getCoordinate()
return x + argx, y + argy return x + argx, y + argy, z + argz
elseif (self.arguments.origin == "start") then elseif (self.arguments.origin == "start") then
local x, y = self.choregraphy.actor.start.x, self.choregraphy.actor.start.y local x, y, z = self.choregraphy.actor.start.x, self.choregraphy.actor.start.y, self.choregraphy.actor.start.z
return x + argx, y + argy return x + argx, y + argy, z + argz
elseif (self.arguments.origin == "actor") then elseif (self.arguments.origin == "actor") then
local x, y = self.choregraphy.actor:getCoordinate() local x, y, z = self.choregraphy.actor:getCoordinate()
return x + argx, y + argy return x + argx, y + argy, z + argz
end end
end end