c1_lua/lua/app/userdata/battle/battle_grid_entity.lua
xiekaidong ccdd6a778b 棋盘
2023-04-06 10:38:04 +08:00

64 lines
1.4 KiB
Lua

local BattleGridEntity = class("BattleGridEntity", BaseData)
function BattleGridEntity:ctor(data)
self.posId = data.posId or 0
self.gridType = data.gridType or GConst.BattleConst.GRID_TYPE.EMPTY
self.elementType = data.elementType or GConst.BattleConst.ELEMENT_TYPE.RED
self.eliminationCount = data.eliminationCount or 0 -- 周围消除次数
self.isIdle = false
end
function BattleGridEntity:getPosId()
return self.posId
end
function BattleGridEntity:setPosId(posId)
self.posId = posId
end
function BattleGridEntity:getGridType()
return self.gridType
end
function BattleGridEntity:getElementType()
return self.elementType
end
function BattleGridEntity:isCantFallType()
return self.elementType == GConst.BattleConst.GRID_TYPE.OBSTACLE
end
function BattleGridEntity:getEliminationCount()
return self.eliminationCount
end
function BattleGridEntity:getPos()
return ModuleManager.BattleManager:getPosInfo(self.posId)
end
function BattleGridEntity:setCell(cell)
self.gridCell = cell
end
function BattleGridEntity:getCell()
return self.gridCell
end
function BattleGridEntity:getIsIdle()
return self.isIdle
end
function BattleGridEntity:setIsIdle(isIdle)
self.isIdle = isIdle == true
end
function BattleGridEntity:canLink()
if self:isCantFallType() then
return false
end
-- 其他类型的一些判定
return true
end
return BattleGridEntity