Beispiel #1
0
    private void ExpandNodeChance(int expandThreshold = 33)
    {
        int[,] _newMapGrid = _mapGrid;

        for (int y = 0; y < mapSize; y++)
        {
            for (int x = 0; x < mapSize; x++)
            {
                if (_mapGrid[y, x] != 0)
                {
                    continue;
                }

                int[,] neighbours = GridMath.GetNeighbours(_mapGrid, new Vector2Int(x, y));
                if (!GridMath.NeighboursContainsX(neighbours, 1))
                {
                    continue;
                }


                if (Roll(33))
                {
                    _newMapGrid[y, x] = 1;
                }
            }
        }

        _mapGrid = _newMapGrid;
    }