Esempio n. 1
0
    public void Rebuild()
    {
        _grid = new bool[size, height, size];
        for (var x = 0; x < _grid.GetLength(0); x++)
        {
            for (var t = 0; t < _grid.GetLength(1); t++)
            {
                for (var y = 0; y < _grid.GetLength(2); y++)
                {
                    if (Random.value * 100 < obstacleFrequency)
                    {
                        _grid[x, t, y] = true;
                    }
                }
            }
        }

        var center = Mathf.RoundToInt(size / 2);

        _start = new GridCoords(0, 0, 0);
        _end   = new GridCoords(size - 1, height - 1, size - 1);

        if (size > 0 && height > 0)
        {
            _path = SpacetimePathFinder.FindPath(
                _grid, _start, _end, 1, 1, 1
                );
        }
    }
 public SpacetimePathFindNode FindPath(
     GridCoords source, GridCoords target, float movementSpeed,
     int maxSteps)
 {
     return(SpacetimePathFinder.FindPath(
                _grid, source, target, CellSize, TimeStep, movementSpeed,
                maxSteps
                ));
 }