2019-08-14 16:26:23 +02:00
|
|
|
local Parent = require("scenes.battlesystem.actors.parent")
|
|
|
|
local Battler = Parent:extend()
|
|
|
|
|
|
|
|
function Battler:new(world, x, y, z)
|
|
|
|
Battler.super.new(self, world, x, y, z)
|
|
|
|
|
|
|
|
self.isBattler = true
|
|
|
|
self.speed = 3
|
|
|
|
self.isActive = false
|
|
|
|
self.debugActiveTimer = 0
|
|
|
|
end
|
|
|
|
|
|
|
|
function Battler:setActive()
|
|
|
|
core.debug:print("cbs/actor","actor " .. self.id .. " is active")
|
|
|
|
self.isActive = true
|
|
|
|
self.debugActiveTimer = 0
|
|
|
|
end
|
|
|
|
|
|
|
|
function Battler:update(dt)
|
|
|
|
if (self.isActive) then
|
|
|
|
self.debugActiveTimer = self.debugActiveTimer + dt
|
2019-08-14 20:44:20 +02:00
|
|
|
core.debug:print("cbs/battler", "debug timer is " .. math.floor(self.debugActiveTimer*100) .. " for battler " .. self.id)
|
2019-08-14 16:26:23 +02:00
|
|
|
if self.debugActiveTimer >= 0.5 then
|
2019-08-14 20:44:20 +02:00
|
|
|
core.debug:print("cbs/battler", "counter ended, switching active battler")
|
2019-08-14 16:26:23 +02:00
|
|
|
self.world:switchActiveBattler()
|
|
|
|
self.isActive = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function Battler:validateAction()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return Battler
|