Skip to content

legacy-entity/manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

manager

Manager for Entity/Component/Systems.

Installing

component-install entity/manager

API

Manager()

Manager class.

Manager.isRoot() =Boolean

Determine whether this is the root manager.

Manager.createEntity(c...:Object) =entity:Entity

Create an entity of components, and use it.

Manager.removeEntity(e:Entity) =this:Manager

Remove an entity.

Manager.removeAllEntities() =this:Manager

Remove all entities.

Manager.applyComponents([e]:Entity)

Apply component data to an entity or all.

Manager.createManager() =new_manager:Manager

Create a child manager and use it.

Manager.of(arr:Array) =entities:Set

Get all entities using all the components in the array.

Manager.each([c...]:Object, fn:Function) =this:Object

Iterate entities of certain components, or through all if no component is passed.

Manager.get(c:Component) =Entity

Get the first entity matching component.

Manager.use(item:Entity|Mixed|Manager, reuse:Boolean) =this:Manager

Use a entity, system or manager.

When entity:

  • Registers an entity (creating a new one or reusing the one passed).

When system:

  • Registers a system to be used. Order matters.

When manager:

  • Adds the manager to its children.

Manager.init() =this:Manager

Game state switches.

States:

init -> ( start - pause - stop ) -> tear
        (---------loop---------)

Manager.reset() =this:Manager

Reset state.

Executes:

stop -> tear -> init -> start

Manager.join(e:Entity) =this:Manager

Join (late) an entity.

It will try to apply components and systems based on the current state.

Manager.snapshot() =Array

Generate an array snapshot of all entities property values.

License

MIT

About

entity component systems manager

Resources

Stars

Watchers

Forks

Packages

No packages published