2019-04-01 08:08:54 +02:00
|
|
|
local BaseWorld = Object:extend()
|
|
|
|
|
|
|
|
function BaseWorld:new(scene)
|
|
|
|
self.scene = scene
|
|
|
|
|
|
|
|
self.entities = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
function BaseWorld:registerEntity(entity)
|
|
|
|
table.insert(self.entities, entity)
|
|
|
|
end
|
|
|
|
|
2019-04-01 12:47:08 +02:00
|
|
|
function BaseWorld:countEntity()
|
|
|
|
return #self.entities
|
|
|
|
end
|
|
|
|
|
2019-04-01 08:08:54 +02:00
|
|
|
function BaseWorld:update(dt)
|
|
|
|
for i,v in ipairs(self.entities) do
|
|
|
|
v:update(dt)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function BaseWorld:draw(dt)
|
|
|
|
for i,v in ipairs(self.entities) do
|
|
|
|
v:draw(dt)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return BaseWorld
|