public void Add(Entity mob) { mob.SetId(_next_id); if (MobEntities.TryAdd(mob.Id, mob)) { _next_id++; mob.SetGridCell(this); EntityCount++; AllEntityCount++; } }
public void ReAdd(Entity mob) { if (MobEntities.TryAdd(mob.Id, mob)) { GridCell cell = mob.GridCell; mob.SetGridCell(this); if (cell != null) { cell.Remove(mob); } EntityCount++; AllEntityCount++; } }