ComponentPoolable class
All components that should be managed in a ObjectPool must extend this class
and have a factory constructor that calls new Poolable.of(...) to create
a component. By doing so, dartemis can handle the construction of
ComponentPoolables and reuse them when they are no longer needed.
class ComponentPoolable extends Component with Poolable {
void _removed() {
moveToPool();
}
/**
* If you need to do some cleanup when removing this component override this
* method.
*/
void cleanUp() {}
}
Extends
Component > Component_Poolable > ComponentPoolable
Subclasses
Animatable, AudioDef, Transform, Transform
Methods
void cleanUp() #
If you need to do some cleanup when removing this component override this method.
void cleanUp() {}
void moveToPool() #
inherited from Component_Poolable
Calls the cleanup function and moves this object to the ObjectPool.
void moveToPool() {
cleanUp();
ObjectPool.add(this);
}