WorldBuilder.BuildWalls C# (CSharp) Метод

BuildWalls() публичный Метод

public BuildWalls ( ) : void
Результат void
    void BuildWalls()
    {
        int cellsPerSide = CellMaster.CellsPerSide;

        var verticalWalls = new Cell[cellsPerSide, cellsPerSide];
        for ( int x = 0; x < CellMaster.CellsPerSide - 1; x++ )
        {
            int wallType = Random.Range( 0, wallPrefabs.Length );
            for( int y = 0; y < CellMaster.CellsPerSide; y++ )
            {
                if ( !CellMaster.GetCellAt( x,y ).canGoEast )
                {
                    CreateWall( CellMaster.GetCellAt( x,y ), Direction.East, wallType );
                    verticalWalls[x,y] = CellMaster.GetCellAt( x,y );

                    if ( y > 0 && verticalWalls[x,y - 1] == null )
                        CreateWallCap ( CellMaster.GetCellAt( x,y ), true );
                }
                else
                {
                    wallType = Random.Range ( 0, wallPrefabs.Length );
                    if ( y > 0 && verticalWalls[x,y - 1] != null )
                        CreateWallCap ( CellMaster.GetCellAt( x,y ), true );
                }
            }
        }

        var horizontalWalls = new Cell[cellsPerSide, cellsPerSide];
        for ( int y = 0; y < cellsPerSide - 1; y++ )
        {
            int wallType = Random.Range ( 0, wallPrefabs.Length );
            for( int x = 0; x < cellsPerSide; x++ )
            {
                if ( !CellMaster.GetCellAt( x,y ).canGoNorth )
                {
                    CreateWall( CellMaster.GetCellAt( x,y ), Direction.North, wallType );
                    horizontalWalls[x,y] = CellMaster.GetCellAt( x,y );

                    if ( x > 0 && horizontalWalls[x - 1,y] == null )
                        CreateWallCap ( CellMaster.GetCellAt( x,y ), false );
                }
                else
                {
                    wallType = Random.Range ( 0, wallPrefabs.Length );
                    if ( x > 0 && horizontalWalls[x - 1,y] != null )
                        CreateWallCap ( CellMaster.GetCellAt( x,y ), false );
                }
            }
        }
    }