Aspect Class
This constructor is used internally by the manager to create aspects and is public only for the purpouse of type checking.
Constructor
Aspect
()
Item Index
Methods
destroy
()
Destroys the aspect, completely removing it from the entity system. If a removed callback is subscribed, it will be called for every entity.
iterate
-
iterator
Function used for working on the entities of an aspect.
Parameters:
-
iterator
FunctionThe iterator function should accept one parameter, an entity.
Example:
aspect.iterate(function(entity){
var position = entity.get(Position);
position.x += 5;
position.y += 3;
});
subscribeAdded
-
callback
Subscribes a function that will be called back each time an entity is added to the aspect.
Parameters:
-
callback
FunctionFunction that will be called back when ever an entity is added to the aspect.
subscribeRemoved
-
callback
Subscribes a function that will be called back each time an entity is removed from the aspect.
Parameters:
-
callback
FunctionFunction that will be called back when ever an entity is removed from the aspect.
unsubscribeAdded
()
Removes the subscription.
unsubscribeAdded
()
Removes the subscription.