/** * @return An array of Entity components. This is a generated array, * and modifying it will not have an effect on components belonging * to this entity. * * WARNING: This is an efficient way to access entitie's components. * Use with care. ComponentMapper is a faster and more efficient way to * access components. */ public Array<Component> getComponents() { return componentManager.getComponents(this); }
/** * Populates provided Array with this Entity's components. * * WARNING: This is an efficient way to access entitie's components. * Use with care. ComponentMapper is a faster and more efficient way to * access components. * * @param array to put the components into. */ public void getComponents(Array<Component> array) { componentManager.getComponents(this, array); }
/** * Returns an array of components for the specified entity. * The Array is generated newly every time and making changes to its * contents will not affect the components belonging to the entity. * * @param e Entity to get Components with. * @return an array of components belonging to entity. */ public Array<Component> getComponents(Entity e) { returnedComponents.clear(); getComponents(e, returnedComponents); return returnedComponents; }
public ComponentMapper(Class<A> type, World world) { components = world.getComponentManager().getComponents(type); }