feat: hook up the choregraphy system to the actions

This commit is contained in:
Kazhnuz 2020-07-24 19:20:48 +02:00
parent a5ec563480
commit 2e38b31dea
3 changed files with 17 additions and 2 deletions

View file

@ -11,7 +11,7 @@ end
function AttackAction:startAction() function AttackAction:startAction()
core.debug:print("cbs/action", "Starting attack action") core.debug:print("cbs/action", "Starting attack action")
self:finishAction() self:loadChoregraphy("attack")
end end
return AttackAction return AttackAction

View file

@ -1,5 +1,7 @@
local ActionParent = Object:extend() local ActionParent = Object:extend()
local ChoregraphySystem = require "scenes.battlesystem.controllers.fighters.systems.choregraphy"
function ActionParent:new(fighter) function ActionParent:new(fighter)
self.fighter = fighter self.fighter = fighter
self.target = nil self.target = nil
@ -14,6 +16,15 @@ function ActionParent:update(dt)
end end
end end
function ActionParent:loadChoregraphy(skillname)
local skill = game.skills:getSkillData(skillname)
self.choregraphy = ChoregraphySystem(self, skill.choregraphy)
end
function ActionParent:loadChoregraphyFromSkill(skill)
self.choregraphy = ChoregraphySystem(self, skill.choregraphy)
end
function ActionParent:needTarget() function ActionParent:needTarget()
-- needTarget, targetEnnemies -- needTarget, targetEnnemies
return false, false return false, false
@ -28,6 +39,10 @@ function ActionParent:start()
self:startAction() self:startAction()
end end
function ActionParent:choregraphyEnded()
self:finishAction()
end
function ActionParent:startAction() function ActionParent:startAction()
self:finishAction() self:finishAction()

View file

@ -12,7 +12,7 @@ end
function SkillAction:startAction() function SkillAction:startAction()
core.debug:print("cbs/action", "Starting flee action") core.debug:print("cbs/action", "Starting flee action")
self:finishAction() self:loadChoregraphyFromSkill(self.data)
end end
return SkillAction return SkillAction