public class TeamManager extends Manager
You may sometimes want to create teams in your game, so that some players are team mates.
A player can only belong to a single team.
world
Constructor and Description |
---|
TeamManager()
Creates a new TeamManager instance.
|
Modifier and Type | Method and Description |
---|---|
ImmutableBag<String> |
getPlayers(String team)
Get all players on a team.
|
String |
getTeam(String player)
The the name of the team the given player is in.
|
protected void |
initialize()
Override to implement code that gets executed when systems are
initialized.
|
void |
removeFromTeam(String player)
Remove a player from his team.
|
void |
setTeam(String player,
String team)
Set the player's team.
|
added, deleted, processSystem, registerManager, setWorld
begin, checkProcessing, dispose, end, getWorld, isEnabled, process, setEnabled
protected void initialize()
BaseSystem
initialize
in class BaseSystem
public String getTeam(String player)
player
- the playerpublic void setTeam(String player, String team)
Each player can only be in one team at a time.
player
- the playerteam
- the team to put the player inpublic ImmutableBag<String> getPlayers(String team)
team
- the teampublic void removeFromTeam(String player)
player
- the player to removeCopyright © 2019. All rights reserved.