36 lines
646 B
Lua
36 lines
646 B
Lua
local BattleConst = require "app/module/battle/battle_const"
|
|
|
|
local BattleUnitComp = class("BattleUnitComp", LuaComponent)
|
|
|
|
local UNIT_STATE = BattleConst.UNIT_STATE
|
|
|
|
function BattleUnitComp:ctor()
|
|
end
|
|
|
|
function BattleUnitComp:init()
|
|
self:_initBase()
|
|
end
|
|
|
|
function BattleUnitComp:_initBase()
|
|
self.isClear = false
|
|
self.isDead = false
|
|
end
|
|
|
|
function BattleUnitComp:tick(dt)
|
|
if self.isClear then
|
|
return
|
|
end
|
|
if self.isDead then
|
|
self:updateDead(dt)
|
|
return
|
|
end
|
|
if self.currState == UNIT_STATE.IDLE then
|
|
self:updateIdle(dt)
|
|
return
|
|
end
|
|
if self.currState == UNIT_STATE.ATTACK then
|
|
self:updateAttack(dt)
|
|
end
|
|
end
|
|
|
|
return BattleUnitComp |