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()
core.debug:print("cbs/action", "Starting attack action")
self:finishAction()
self:loadChoregraphy("attack")
end
return AttackAction

View file

@ -1,5 +1,7 @@
local ActionParent = Object:extend()
local ChoregraphySystem = require "scenes.battlesystem.controllers.fighters.systems.choregraphy"
function ActionParent:new(fighter)
self.fighter = fighter
self.target = nil
@ -14,6 +16,15 @@ function ActionParent:update(dt)
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()
-- needTarget, targetEnnemies
return false, false
@ -28,6 +39,10 @@ function ActionParent:start()
self:startAction()
end
function ActionParent:choregraphyEnded()
self:finishAction()
end
function ActionParent:startAction()
self:finishAction()

View file

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