public class GroupManager extends BaseSystem
You must retrieve it using world instance.
A entity can be assigned to more than one group.
world
Constructor and Description |
---|
GroupManager()
Creates a new GroupManager instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Entity e,
String group)
Set the group of the entity.
|
ImmutableBag<Entity> |
getEntities(String group)
Get all entities that belong to the provided group.
|
ImmutableBag<String> |
getGroups(Entity e)
Get all groups the entity belongs to.
|
protected void |
initialize()
Override to implement code that gets executed when systems are
initialized.
|
boolean |
isInAnyGroup(Entity e)
Checks if the entity belongs to any group.
|
boolean |
isInGroup(Entity e,
String group)
Check if the entity is in the supplied group.
|
protected void |
processSystem()
Process the system.
|
void |
remove(Entity e,
String group)
Remove the entity from the specified group.
|
void |
removeFromAllGroups(Entity e)
Remove the entity from all groups.
|
begin, checkProcessing, dispose, end, getWorld, isEnabled, process, setEnabled, setWorld
protected void processSystem()
BaseSystem
processSystem
in class BaseSystem
protected void initialize()
BaseSystem
initialize
in class BaseSystem
public void add(Entity e, String group)
group
- group to add the entity intoe
- entity to add into the grouppublic void remove(Entity e, String group)
e
- entity to remove from groupgroup
- group to remove the entity frompublic void removeFromAllGroups(Entity e)
e
- the entity to removepublic ImmutableBag<Entity> getEntities(String group)
group
- name of the grouppublic ImmutableBag<String> getGroups(Entity e)
e
- the entitypublic boolean isInAnyGroup(Entity e)
e
- the entity to checkCopyright © 2016. All rights reserved.