52 lines
1.1 KiB
Lua
52 lines
1.1 KiB
Lua
local FighterControllerParent = Object:extend()
|
|
|
|
function FighterControllerParent:new(turnSystem)
|
|
self.turnSystem = turnSystem
|
|
self.world = turnSystem.world
|
|
self.list = {}
|
|
end
|
|
|
|
function FighterControllerParent:add(fighter)
|
|
table.insert(self.list, fighter)
|
|
end
|
|
|
|
function FighterControllerParent:count()
|
|
return #self.list
|
|
end
|
|
|
|
function FighterControllerParent:setActive(activeActor)
|
|
self.activeActor = activeActor
|
|
activeActor:setActive()
|
|
end
|
|
|
|
function FighterControllerParent:update(dt)
|
|
for i, fighter in ipairs(self.list) do
|
|
fighter:updateAssets(dt)
|
|
end
|
|
end
|
|
|
|
function FighterControllerParent:endAction()
|
|
self.owner:nextAction()
|
|
end
|
|
|
|
function FighterControllerParent:putActions(actionList)
|
|
for i, fighter in ipairs(self.list) do
|
|
|
|
if fighter:canFight() then
|
|
for i=1, fighter:getNbrActionPerTurn() do
|
|
local action = {}
|
|
action.fighter = fighter
|
|
action.number = i
|
|
table.insert(actionList, action)
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|
|
|
|
function FighterControllerParent:draw()
|
|
--Aucun dessin par defaut, ils sont géré différements
|
|
end
|
|
|
|
|
|
return FighterControllerParent
|