2021-03-19 18:58:05 +00:00
|
|
|
Unit = {
|
|
|
|
class = "Unit",
|
|
|
|
faction = 0,
|
|
|
|
troops = {},
|
|
|
|
is_selected = false,
|
2021-03-22 17:14:10 +00:00
|
|
|
portrait = nil
|
2021-03-19 18:58:05 +00:00
|
|
|
}
|
2021-03-22 17:14:10 +00:00
|
|
|
function Unit:newUnit(name,faction,portrait,stat_table,banner_path)
|
2021-03-19 18:58:05 +00:00
|
|
|
o = {
|
|
|
|
-- ids
|
|
|
|
name = name,
|
|
|
|
faction = faction,
|
2021-03-22 17:14:10 +00:00
|
|
|
portrait = love.graphics.newImage(portrait)
|
2021-03-19 18:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setmetatable(o, self)
|
|
|
|
self.__index = self
|
|
|
|
return o
|
2021-03-22 17:14:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function addToUnit(u,t)
|
|
|
|
t.faction = u.faction
|
|
|
|
t.is_selected = t.is_selected
|
|
|
|
table.insert(u.troops,t)
|
2021-03-19 18:58:05 +00:00
|
|
|
end
|