Members
entities :Array.<Entity>
Type:
- Array.<Entity>
entitySystems :Array.<EntitySystem>
Type:
- Array.<EntitySystem>
initialized :boolean
Type:
- boolean
managers :Array.<Manager>
Type:
- Array.<Manager>
ticks :number
Type:
- number
voidSystems :Array.<VoidSystem>
Type:
- Array.<VoidSystem>
Methods
addEntity(entity) → {World}
Add entity to the world
Parameters:
Name | Type | Description |
---|---|---|
entity |
Entity |
Returns:
- Type
- World
addEntitySystem(system)
Add new entity system to the world
Parameters:
Name | Type | Description |
---|---|---|
system |
EntitySystem |
addManager(manager) → {World}
Add Manager
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager | Manager instance |
Returns:
- Type
- World
addVoidSystem(system)
Add new void system to the world
Parameters:
Name | Type | Description |
---|---|---|
system |
VoidSystem |
createEntity(components) → {Entity}
Creates and adds a new entity
Parameters:
Name | Type | Description |
---|---|---|
components |
Array.<Component> |
Returns:
- Type
- Entity
getEntities() → {Array.<Entity>}
Get all entities from wold
Returns:
- Type
- Array.<Entity>
getEntitiesWithComponent(component) → {Array.<Entity>}
Get a list of entities that match a component
Parameters:
Name | Type | Description |
---|---|---|
component |
function |
Returns:
- Type
- Array.<Entity>
getEntitiesWithComponents(components) → {Array.<Entity>}
Get a list of entities that match a component
Parameters:
Name | Type | Description |
---|---|---|
components |
Array.<function()> |
Returns:
- Type
- Array.<Entity>
getEntity(index) → {Entity}
Get entity from world by its id
Parameters:
Name | Type | Description |
---|---|---|
index |
number |
Throws:
Error
Returns:
- Type
- Entity
getEntitySystems() → {Array.<EntitySystem>}
Returns:
- Type
- Array.<EntitySystem>
getManager(managerClass) → {Manager}
Get a manager
Parameters:
Name | Type | Description |
---|---|---|
managerClass |
function | Manager class constructor |
Throws:
Error
Returns:
- Type
- Manager
getManagers() → {Array.<Manager>}
Returns:
- Type
- Array.<Manager>
getSystem(systemClass) → {System}
get a System
Parameters:
Name | Type | Description |
---|---|---|
systemClass |
function | Class constructor |
Throws:
Error
Returns:
- Type
- System
getVoidSystems() → {Array.<VoidSystem>}
Returns:
- Type
- Array.<VoidSystem>
init() → {World}
After all systems has been added, this should be called to initiate them
Returns:
- Type
- World
removeSystem(systemClass) → {World}
Remove System
Parameters:
Name | Type | Description |
---|---|---|
systemClass |
function | Class constructor |
Returns:
- Type
- World
update()
Update the world
Throws:
Error