Aspect Class
An Aspects is used by systems as a matcher against entities, to check if a system is interested in an entity. Aspects define what sort of component types an entity must possess, or not possess.
This creates an aspect where an entity must possess A and B and C: Aspect.getAspectForAll(A.class, B.class, C.class)
This creates an aspect where an entity must possess A and B and C, but must not possess U or V. Aspect.getAspectForAll(A.class, B.class, C.class).exclude(U.class, V.class)
This creates an aspect where an entity must possess A and B and C, but must not possess U or V, but must possess one of X or Y or Z. Aspect.getAspectForAll(A.class, B.class, C.class).exclude(U.class, V.class).one(X.class, Y.class, Z.class)
You can create and compose aspects in many ways: Aspect.getEmpty().one(X.class, Y.class, Z.class).all(A.class, B.class, C.class).exclude(U.class, V.class) is the same as: Aspect.getAspectForAll(A.class, B.class, C.class).exclude(U.class, V.class).one(X.class, Y.class, Z.class)
Item Index
Methods
Properties
Methods
all
-
type
Returns an aspect where an entity must possess all of the specified component types.
Parameters:
-
type
String multiplea required component type
exclude
-
type
Excludes all of the specified component types from the aspect. A system will not be interested in an entity that possesses one of the specified exclusion component types.
Parameters:
-
type
String multiplecomponent type to exclude
getAllSet
()
ArtemiJS.Utils.Bag
Returns:
getAspectForAll
-
type
Creates an aspect where an entity must possess all of the specified component types.
Parameters:
-
type
String multiplea required component type
Returns:
getAspectForOne
-
type
Creates an aspect where an entity must possess one of the specified component types.
Parameters:
-
type
String multipleone of the types the entity must possess
Returns:
getEmpty
()
ArtemiJS.Aspect
Creates and returns an empty aspect. This can be used if you want a system that processes no entities, but still gets invoked. Typical usages is when you need to create special purpose systems for debug rendering, like rendering FPS, how many entities are active in the world, etc.
You can also use the all, one and exclude methods on this aspect, so if you wanted to create a system that processes only entities possessing just one of the components A or B or C, then you can do: Aspect.getEmpty().one(A,B,C);
Returns:
getExclusionSet
()
ArtemiJS.Utils.Bag
Returns:
getOneSet
()
ArtemiJS.Utils.Bag
Returns:
one
-
type
Returns an aspect where an entity must possess one of the specified component types.
Parameters:
-
type
String multipleone of the types the entity must possess