示例#1
0
        public Searchspace(Vector2 size, ImmutableList <CollisionBox <ProductionBuilding> > components, ImmutableList <CollisionBox <FlowBuilding> > routes, ImmutableHashSet <IPhysicalBuilding>[,] grid = null)
        {
            _size       = size;
            _components = components;
            _routes     = routes;

            _grid = new ImmutableHashSet <IPhysicalBuilding> [(int)_size.X, (int)_size.Y];
            if (grid == null)
            {
                for (int x = 0; x < _size.X; x++)
                {
                    for (int y = 0; y < _size.Y; y++)
                    {
                        _grid[x, y] = ImmutableHashSet <IPhysicalBuilding> .Empty;
                    }
                }
            }
            else
            {
                _grid = (ImmutableHashSet <IPhysicalBuilding> [, ])grid.Clone();
            }
        }