Class: World

World()

The world contains all entities, systems and managers

Constructor

new World()

Source:

Members

entities :Array.<Entity>

Type:
Source:

entitySystems :Array.<EntitySystem>

Type:
Source:

initialized :boolean

Type:
  • boolean
Source:

managers :Array.<Manager>

Type:
Source:

ticks :number

Type:
  • number
Source:

voidSystems :Array.<VoidSystem>

Type:
Source:

Methods

addEntity(entity) → {World}

Add entity to the world
Parameters:
Name Type Description
entity Entity
Source:
Returns:
Type
World

addEntitySystem(system)

Add new entity system to the world
Parameters:
Name Type Description
system EntitySystem
Source:

addManager(manager) → {World}

Add Manager
Parameters:
Name Type Description
manager Manager Manager instance
Source:
Returns:
Type
World

addVoidSystem(system)

Add new void system to the world
Parameters:
Name Type Description
system VoidSystem
Source:

createEntity(components) → {Entity}

Creates and adds a new entity
Parameters:
Name Type Description
components Array.<Component>
Source:
Returns:
Type
Entity

getEntities() → {Array.<Entity>}

Get all entities from wold
Source:
Returns:
Type
Array.<Entity>

getEntitiesWithComponent(component) → {Array.<Entity>}

Get a list of entities that match a component
Parameters:
Name Type Description
component function
Source:
Returns:
Type
Array.<Entity>

getEntitiesWithComponents(components) → {Array.<Entity>}

Get a list of entities that match a component
Parameters:
Name Type Description
components Array.<function()>
Source:
Returns:
Type
Array.<Entity>

getEntity(index) → {Entity}

Get entity from world by its id
Parameters:
Name Type Description
index number
Source:
Throws:
Error
Returns:
Type
Entity

getEntitySystems() → {Array.<EntitySystem>}

Source:
Returns:
Type
Array.<EntitySystem>

getManager(managerClass) → {Manager}

Get a manager
Parameters:
Name Type Description
managerClass function Manager class constructor
Source:
Throws:
Error
Returns:
Type
Manager

getManagers() → {Array.<Manager>}

Source:
Returns:
Type
Array.<Manager>

getSystem(systemClass) → {System}

get a System
Parameters:
Name Type Description
systemClass function Class constructor
Source:
Throws:
Error
Returns:
Type
System

getVoidSystems() → {Array.<VoidSystem>}

Source:
Returns:
Type
Array.<VoidSystem>

init() → {World}

After all systems has been added, this should be called to initiate them
Source:
Returns:
Type
World

removeSystem(systemClass) → {World}

Remove System
Parameters:
Name Type Description
systemClass function Class constructor
Source:
Returns:
Type
World

update()

Update the world
Source:
Throws:
Error