示例#1
0
 public void SetNeighbors(RenderCell north, RenderCell south, RenderCell east, RenderCell west)
 {
     North = north;
     South = south;
     East  = east;
     West  = west;
 }
示例#2
0
 void RemoveIsolatedConnector(RenderCell[][] renderGrid)
 {
     for (int rowIndex = 2; rowIndex < RowCount - 1; rowIndex += 2)
     {
         for (int columnIndex = 2; columnIndex < ColumnCount - 1; columnIndex += 2)
         {
             RenderCell connector = renderGrid[rowIndex][columnIndex];
             if (connector.Neighbors.All(n => n.RenderType != RenderType.Wall))
             {
                 connector.RenderType = RenderType.Ground;
             }
         }
     }
 }
示例#3
0
 static void SetCellAndLinkedPart(RenderCell[][] renderGrid, Grid grid)
 {
     foreach (GridCell cell in grid.GetCells())
     {
         int        centerRowIndex    = TranslateGridIndex(cell.Row);
         int        centerColumnIndex = TranslateGridIndex(cell.Column);
         RenderCell center            = renderGrid[centerRowIndex][centerColumnIndex];
         center.RenderType = RenderType.Ground;
         center.SetTags(cell.Tags);
         renderGrid[centerRowIndex + 1][centerColumnIndex + 1].RenderType = RenderType.Wall;
         renderGrid[centerRowIndex][centerColumnIndex + 1].RenderType     =
             cell.IsLinked(cell.East) ? RenderType.Ground : RenderType.Wall;
         renderGrid[centerRowIndex + 1][centerColumnIndex].RenderType =
             cell.IsLinked(cell.South) ? RenderType.Ground : RenderType.Wall;
     }
 }
示例#4
0
        RenderCell[][] AllocateGrid()
        {
            var theGrid = new RenderCell[RowCount][];

            for (int rowIndex = 0; rowIndex < RowCount; ++rowIndex)
            {
                var currentRow = new RenderCell[ColumnCount];
                for (int columnIndex = 0; columnIndex < ColumnCount; ++columnIndex)
                {
                    currentRow[columnIndex] = new RenderCell(rowIndex, columnIndex);
                }

                theGrid[rowIndex] = currentRow;
            }

            return(theGrid);
        }