A class in Root.Township, Alta.Chunks.
Server: the players that have a chunk loaded. Each Chunk has one as Players, and the chunk loads or unloads when the first player is added or the last removed.
Constructors
Fields
| Member | What it is |
|---|
protected HashSet<Player> players | The set of players, compared as Unity objects. |
Properties
| Member | What it is |
|---|
Chunk Chunk { get; } | The chunk these players have loaded. |
int Count { get; } | How many players have the chunk loaded. |
IEnumerable<Player> Items { get; } | The players that have the chunk loaded. |
Events
| Member | What it is |
|---|
event Action FirstItemAdded | Fired when the first player is added. |
event Action<Player> ItemAdded | Fired with each player added. |
event Action<Player> ItemRemoved | Fired with each player removed. |
event Action LastItemRemoved | Fired when the last player is removed. |
Methods
| Member | What it is |
|---|
bool Add(Player player) | Marks the chunk as loaded for the player and adds them. Returns false if the player already had it in LoadedChunks. |
bool Remove(Player player) | Removes the chunk from the player's LoadedChunks and removes them. Returns false if the player didn't have it loaded. |
void RemoveAll() | Removes every player. |
2 private and internal methods
| Member | What it is |
|---|
private void OnItemAdded(Player player) | Fires FirstItemAdded if this is the first player, then ItemAdded. |
private void OnItemRemoved(Player player) | Fires ItemRemoved, then LastItemRemoved if no players are left. |
Used in
Members of other types that take, return or hold a ChunkPlayerManager: