예제 #1
0
        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);
        }
예제 #2
0
파일: GridCell.cs 프로젝트: HiPoEGH/Nav
        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());
        }
예제 #3
0
        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);
        }
예제 #4
0
파일: GridCell.cs 프로젝트: HiPoEGH/Nav
        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));
            }
        }
예제 #5
0
파일: GridCell.cs 프로젝트: HiPoEGH/Nav
 internal void RemoveReplacementCell(Cell cell)
 {
     cell.Detach();
     ReplacementCells.Remove(cell);
 }
예제 #6
0
파일: GridCell.cs 프로젝트: HiPoEGH/Nav
 internal void AddReplacementCell(Cell cell)
 {
     ReplacementCells.Add(cell);
 }
예제 #7
0
파일: GridCell.cs 프로젝트: HiPoEGH/Nav
 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)))));
 }
예제 #8
0
 internal void ResetReplacementCells()
 {
     ReplacementCells.Clear();
 }