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... groups)
Set the group of the entity.
|
void |
add(Entity e,
String group)
Set the group of the entity.
|
void |
add(Entity e,
String g1,
String g2)
Set the group of the entity.
|
void |
add(Entity e,
String g1,
String g2,
String g3)
Set the group of the entity.
|
void |
add(int entityId,
String... groups) |
void |
add(int entityId,
String group) |
void |
add(int entityId,
String g1,
String g2) |
void |
add(int entityId,
String g1,
String g2,
String g3) |
ImmutableBag<Entity> |
getEntities(String group)
Get all entities that belong to the provided group.
|
ImmutableIntBag |
getEntityIds(String group) |
ImmutableBag<String> |
getGroups(Entity e)
Get all groups the entity belongs to.
|
ImmutableBag<String> |
getGroups(int entityId) |
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 |
isInAnyGroup(int entityId) |
boolean |
isInGroup(Entity e,
String group)
Check if the entity is in the supplied group.
|
boolean |
isInGroup(int entityId,
String group) |
protected void |
processSystem()
Process the system.
|
void |
remove(Entity e,
String... groups)
Removes the entity from the specified groups
|
void |
remove(Entity e,
String group)
Remove the entity from the specified group.
|
void |
remove(Entity e,
String g1,
String g2)
Removes the entity from the specified groups.
|
void |
remove(Entity e,
String g1,
String g2,
String g3)
Removes the entity from the specified groups.
|
void |
remove(int entityId,
String... groups) |
void |
remove(int entityId,
String group) |
void |
remove(int entityId,
String g1,
String g2) |
void |
remove(int entityId,
String g1,
String g2,
String g3) |
void |
removeFromAllGroups(Entity e)
Remove the entity from all groups.
|
void |
removeFromAllGroups(int entityId) |
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 add(int entityId, String group)
public void add(Entity e, String g1, String g2)
g1
- group to add the entity intog2
- group to add the entity intoe
- entity to add into the grouppublic void add(Entity e, String g1, String g2, String g3)
g1
- group to add the entity intog2
- group to add the entity intog3
- group to add the entity intoe
- entity to add into the grouppublic void add(Entity e, String... groups)
groups
- groups to add the entity intoe
- entity to add into the grouppublic void add(int entityId, String... groups)
public void remove(Entity e, String group)
e
- entity to remove from groupgroup
- group to remove the entity frompublic void remove(int entityId, String group)
public void remove(Entity e, String g1, String g2)
e
- entity to remove from groupg1
- group to remove the entity fromg2
- group to remove the entity frompublic void remove(Entity e, String g1, String g2, String g3)
e
- entity to remove from groupg1
- group to remove the entity fromg2
- group to remove the entity fromg3
- group to remove the entity frompublic void remove(Entity e, String... groups)
e
- entity to remove from groupgroups
- groups to remove the entity frompublic void remove(int entityId, String... groups)
public void removeFromAllGroups(Entity e)
e
- the entity to removepublic void removeFromAllGroups(int entityId)
public ImmutableBag<Entity> getEntities(String group)
group
- name of the grouppublic ImmutableIntBag getEntityIds(String group)
public ImmutableBag<String> getGroups(Entity e)
e
- the entitypublic ImmutableBag<String> getGroups(int entityId)
public boolean isInAnyGroup(Entity e)
e
- the entity to checkpublic boolean isInAnyGroup(int entityId)
public boolean isInGroup(Entity e, String group)
group
- the group to check ine
- the entity to check forpublic boolean isInGroup(int entityId, String group)
Copyright © 2019. All rights reserved.