mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-02 20:33:54 -04:00
Polishing
This commit is contained in:
parent
58549d6b0a
commit
2d21fe97a5
8 changed files with 136 additions and 109 deletions
|
@ -1,22 +1,14 @@
|
|||
local Entity = {
|
||||
entities = {},
|
||||
}
|
||||
local Entity = {}
|
||||
Entity.__index = Entity
|
||||
|
||||
--- Creates and initializes a new Entity.
|
||||
-- @return A new Entity
|
||||
function Entity.new()
|
||||
local e = setmetatable({
|
||||
id = #Entity.entities + 1,
|
||||
components = {},
|
||||
systems = {},
|
||||
keys = {},
|
||||
|
||||
instance = nil,
|
||||
instance = nil,
|
||||
}, Entity)
|
||||
|
||||
Entity.entities[e.id] = e
|
||||
|
||||
return e
|
||||
end
|
||||
|
||||
|
@ -25,7 +17,7 @@ end
|
|||
-- @param ... The values passed to the Component
|
||||
-- @return self
|
||||
function Entity:give(component, ...)
|
||||
self.components[component] = component:initialize(...)
|
||||
self.components[component] = component:__initialize(...)
|
||||
|
||||
return self
|
||||
end
|
||||
|
@ -47,15 +39,6 @@ function Entity:check()
|
|||
return self
|
||||
end
|
||||
|
||||
--- Removed an Entity from the instance.
|
||||
-- @return self
|
||||
function Entity:destroy()
|
||||
Entity.entities[self.id] = nil
|
||||
self.instance:destroyEntity(self)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Gets a Component from the Entity
|
||||
-- @param component The Component to get
|
||||
-- @return The Bag from the Component
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue