public void Add(ISwarmable swarmable) { if (!swarmable.CanJoinSwarm) { return; } _swarmables.Add(swarmable); swarmable.JoinSwarm(this, _swarmRadius); }
public int Remove(int amount) { int removed = 0; for (int i = 0; i < _swarmables.Count && removed < amount; ++i) { ISwarmable swarmable = _swarmables[i]; swarmable.RemoveFromSwarm(); removed++; } _swarmables.RemoveRange(0, removed); return(removed); }