public void GeneratePrivatePaths()
    {
        Dijkstra <Voxel, Edge <Voxel> > dijkstra = new EasyGraph.Dijkstra <Voxel, Edge <Voxel> >(_voxelGrid.VoxelGraph);

        int createdPaths = 0;

        while (createdPaths < _targetPrivateAmount)
        {
            // get a random voxel for boundary
            var origin = GetRandomBoundaryVoxel();

            //_privateNode.AddRange(dijkstra.DijkstraCalculateWeights(origin));
            //var origin = GetRandomBoundaryVoxel(_privateNode);
            //var origin = _privateNode.GetRandomBoundaryVoxel().ToList();

            dijkstra.DijkstraCalculateWeights(origin);

            // try to connect to the closest point in the public path of this layer
            // if none available, use the closest point

            Voxel target;

            var targetsOnLayer = _publicPath.Where(v => v.Index.y == origin.Index.y).ToList();
            if (targetsOnLayer.Count > 0)
            {
                target = targetsOnLayer.MinBy(v => dijkstra.VertexWeight(v));
            }
            else
            {
                target = _publicPath.MinBy(v => dijkstra.VertexWeight(v));
            }

            var path = dijkstra.GetShortestPath(origin, target);
            foreach (var voxel in path)
            {
                if (!_publicPath.Contains(voxel))
                {
                    voxel.SetAsPrivatePath();
                    //voxel.SetAsPrivateVoxel();
                    if (!_privatePath.Contains(voxel))
                    {
                        _privatePath.Add(voxel);
                    }
                }
            }
            createdPaths++; // createdPaths = createdPaths + 1;
            Debug.Log("private path " + _privatePath.Count);
        }
    }
    private IEnumerator GeneratePrivatePathsAnimated()
    {
        Dijkstra <Voxel, Edge <Voxel> > dijkstra = new EasyGraph.Dijkstra <Voxel, Edge <Voxel> >(_voxelGrid.VoxelGraph);

        int createdPaths = 0;

        while (createdPaths < _targetPrivateAmount)
        {
            // get a random voxel
            var origin = GetRandomBoundaryVoxel();
            foreach (var voxel in _privateNode)
            {
                Debug.Log("private node " + _privateNode.Count);
            }
            dijkstra.DijkstraCalculateWeights(origin);

            // try to connect to the closest point in the public path of this layer
            // if none available, use the closest point
            Voxel target;
            var   targetsOnLayer = _publicPath.Where(v => v.Index.y == origin.Index.y).ToList();
            if (targetsOnLayer.Count > 0)
            {
                target = targetsOnLayer.MinBy(v => dijkstra.VertexWeight(v));
            }
            else
            {
                target = _publicPath.MinBy(v => dijkstra.VertexWeight(v));
            }

            var path = dijkstra.GetShortestPath(origin, target);
            foreach (var voxel in path)
            {
                if (!_publicPath.Contains(voxel))
                {
                    voxel.SetAsPrivateVoxel();
                    if (!_privatePath.Contains(voxel))
                    {
                        _privatePath.Add(voxel);
                    }
                    Debug.Log("private path " + _privatePath.Count);
                }
            }
            createdPaths++;
            yield return(new WaitForSeconds(0.1f));
        }
    }