public IEnumerable <Cell> GetCellsAt(Vec3 pos, bool test_2d, float z_tolerance, bool include_replacement = true) { var cells = Cells.Where(x => (test_2d ? x.Contains2D(pos) : x.Contains(pos, z_tolerance))); if (include_replacement) { return(cells.Concat(ReplacementCells.Where(x => (test_2d ? x.Contains2D(pos) : x.Contains(pos, z_tolerance))))); } return(cells); }
public List <Cell> GetCells(Func <Cell, bool> predicate, bool allow_replacement_cells = true) { var result = Cells.Where(predicate); if (allow_replacement_cells) { result = result.Concat(ReplacementCells.Where(predicate)); } return(result.ToList()); }
public List <Cell> GetCells(Func <Cell, bool> predicate, bool include_replacement = true) { var result = Cells.Where(predicate).ToList(); if (include_replacement) { result.AddRange(ReplacementCells.Where(predicate)); } return(result); }
internal void Deserialize(HashSet <GridCell> all_grid_cells, HashSet <Cell> all_cells, BinaryReader r) { base.Deserialize(all_grid_cells, r); int cells_count = r.ReadInt32(); for (int i = 0; i < cells_count; ++i) { int cell_global_id = r.ReadInt32(); Cells.AddFirst(all_cells.First(x => x.GlobalId == cell_global_id)); } int replacement_cells_count = r.ReadInt32(); for (int i = 0; i < replacement_cells_count; ++i) { int cell_global_id = r.ReadInt32(); ReplacementCells.Add(all_cells.First(x => x.GlobalId == cell_global_id)); } }
internal void RemoveReplacementCell(Cell cell) { cell.Detach(); ReplacementCells.Remove(cell); }
internal void AddReplacementCell(Cell cell) { ReplacementCells.Add(cell); }
public IEnumerable <Cell> GetCellsAt(Vec3 pos, bool test_2d, float z_tolerance) { return(Cells.Where(x => (test_2d ? x.Contains2D(pos) : x.Contains(pos, z_tolerance))). Concat(ReplacementCells.Where(x => (test_2d ? x.Contains2D(pos) : x.Contains(pos, z_tolerance))))); }
internal void ResetReplacementCells() { ReplacementCells.Clear(); }