Search in sources :

Example 1 with ParentComponent

use of com.gemserk.commons.artemis.components.ParentComponent in project commons-gdx by gemserk.

the class HierarchySystem method removed.

@Override
protected void removed(Entity entity) {
    ParentComponent parentComponent = entity.getComponent(ParentComponent.class);
    // if for some reason the entity parent component was removed before this method was called
    if (parentComponent == null)
        return;
    entity.removeComponent(parentComponent);
    ArrayList<Entity> children = parentComponent.getChildren();
    for (int i = 0; i < children.size(); i++) {
        Entity child = children.get(i);
        world.deleteEntity(child);
    }
}
Also used : Entity(com.artemis.Entity) ParentComponent(com.gemserk.commons.artemis.components.ParentComponent)

Aggregations

Entity (com.artemis.Entity)1 ParentComponent (com.gemserk.commons.artemis.components.ParentComponent)1