int iGridSizeX, iGridSizeY;         //Size of the Grid in Array units.


    private void Start()                                                    //Ran once the program starts
    {
        fNodeDiameter = fNodeRadius * 2;                                    //Double the radius to get diameter
        iGridSizeX    = Mathf.RoundToInt(vGridWorldSize.x / fNodeDiameter); //Divide the grids world co-ordinates by the diameter to get the size of the graph in array units.
        iGridSizeY    = Mathf.RoundToInt(vGridWorldSize.y / fNodeDiameter); //Divide the grids world co-ordinates by the diameter to get the size of the graph in array units.
        CreateGrid();                                                       //Draw the grid
        DijkstraTile[,] dijtraGrid    = DijkstraGrid.generateDijkstraGrid(this.NodeArray, new Vector2Int(iGridSizeX, iGridSizeY), NodeFromWorldPoint(StartPosition.position));
        DijkstraTile[,] flowFieldGrid = FlowFieldGrid.generateFlowField(new Vector2Int(iGridSizeX, iGridSizeY), dijtraGrid);
    }
    public void CreateDebugGrid(Vector2Int dimensions, float cellSize, bool isDiagonal)
    {
        _grid      = new FlowFieldGrid(dimensions, cellSize, isDiagonal);
        _debugGrid = new FlowFieldDebugCell[_grid.Rows * _grid.Colums];

        for (int y = 0; y < _grid.Colums; ++y)
        {
            for (int x = 0; x < _grid.Rows; ++x)
            {
                GameObject gridUnit = Instantiate(_debugCellTemplate, transform);

                float posX = x * _grid.CellSize;
                float posZ = y * _grid.CellSize;

                gridUnit.transform.position = new Vector3(posX, 0, posZ);

                FlowFieldDebugCell debugCell = gridUnit.GetComponent <FlowFieldDebugCell>();
                debugCell.Cell = _grid.Cells[x + y * _grid.Rows];

                _debugGrid[x + y * _grid.Rows] = debugCell;
            }
        }
    }