public class GroupManager extends Manager
You must retrieve it using world instance.
A entity can be assigned to more than one group.
| 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.
|
void |
deleted(Entity e)
Removes the entity from all groups.
|
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()
Called when the world initializes.
|
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.
|
void |
remove(Entity e,
String group)
Remove the entity from the specified group.
|
void |
removeFromAllGroups(Entity e)
Remove the entity from all groups.
|
protected void initialize()
ManagerOverride to implement custom behavior at initialization.
initialize in class Managerpublic 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 checkpublic boolean isInGroup(Entity e, String group)
group - the group to check ine - the entity to check forpublic void deleted(Entity e)
deleted in interface EntityObserverdeleted in class Managere - the deleted entityCopyright © 2014. All Rights Reserved.