Added EntityCollection
which enables you to access entities directly by their id
.
engine.entities.get(1);
Type definition fix for Class
and ComponentClass
.
100% code coverage & code cleanup.
Fixed component caching bug, not returning all components for a string type per component instance.
Fixed aspect bugs.
Components can now also have an optional id
.
Aspects support the id value for filtering certain entities.
Target ES5.
Fixed vulnerabilities in package.json.
This version adds improvements to the Aspect
and AbstractEntitySystem
classes.
Aspect
is now a dispatcher, which dispatches events likeonAddedEntities
,onAddedComponents
, etc.AbstractEntitySystem
listens for the new dispatched events and adds stub methods for systems extending the abstraction. This way you can avoid boilerplate code.- Various minor fixes.
This version includes breaking changes for filtering entities by components.
- Upgrade to Typescript 3.6.3
- Renamed
Filter
toAspect
- The API changed.
- Instead of using
Filter.getFor(...)
use nowAspect.for(engine|collection).one(...)
to get the old behavior. Aspect
provides 3 more methods for better filtering:all
,exclude
andone
.
Engine
has nogetFilter
method anymore. UseAspect.for(engine)
instead.- Options for
Engine.run
is now an optional argument. - New
AbstractEntitySystem
which can be used for systems which process entities.- Use this class to keep boilerplate code low.
- Those systems can pass component type arguments to the super constructor, to auto filter entities within an engine.