public void RegisterChunk(ChunkCoords chunkCoords, PlayerConnection player) { // Ensure chunk loaded or generated var chunk = WorldData.WorldMap.Chunk(chunkCoords.X, chunkCoords.Z); if (!registrations.ContainsKey(chunkCoords)) { registrations [chunkCoords] = new List <PlayerConnection> (); } registrations[chunkCoords].Add(player); }
public void UnRegisterChunk(ChunkCoords chunkCoords, PlayerConnection player) { var reg = registrations [chunkCoords]; if (reg != null) { reg.Remove(player); if (reg.Count == 0) { registrations.Remove(chunkCoords); } } }