partial void pAfterAddVob(BaseVob vob) { if (!vob.IsStatic) { // find the cell for this vob Vec2i coords = BigCell.GetCoords(vob.Position); int coord = BigCell.GetCoordinate(coords.X, coords.Y); BigCell cell; if (!cells.TryGetValue(coord, out cell)) { cell = new BigCell(this, coords.X, coords.Y); cells.Add(coord, cell); } vob.AddToCell(cell); } }
internal void UpdateVobCell(BaseVob vob, Vec3f pos) { if (vob == null) { throw new ArgumentNullException("Vob is null!"); } Vec2i coords = BigCell.GetCoords(pos); if (coords.X != vob.Cell.X || coords.Y != vob.Cell.Y) { vob.RemoveFromCell(); int coord = BigCell.GetCoordinate(coords.X, coords.Y); BigCell cell; if (!cells.TryGetValue(coord, out cell)) { cell = new BigCell(this, coords.X, coords.Y); cells.Add(coord, cell); } vob.AddToCell(cell); } }