private IEnumerable <CellConnection> GetNeighbors(int cellX, int cellY, CellConnections[,] cells, int gridWidth, int gridHeight)
 {
     if (cellX > 0)
     {
         CellConnections neighbor = cells[cellX - 1, cellY];
         yield return(new RightNeighbor(neighbor));
     }
     if (cellX < gridWidth - 1)
     {
         CellConnections neighbor = cells[cellX + 1, cellY];
         yield return(new LeftNeighbor(neighbor));
     }
     if (cellY > 0)
     {
         CellConnections neighbor = cells[cellX, cellY - 1];
         yield return(new DownNeighbor(neighbor));
     }
     if (cellY < gridHeight - 1)
     {
         CellConnections neighbor = cells[cellX, cellY + 1];
         yield return(new UpNeighbor(neighbor));
     }
 }
示例#2
0
 public CellState(IEnumerable <Tile> remainingOptions, CellConnections connections)
 {
     Connections      = connections;
     RemainingOptions = remainingOptions.ToList().AsReadOnly();
     CurrentChoice    = RemainingOptions[0];
 }
示例#3
0
 internal CellState GetCellState(CellConnections connections)
 {
     return(cellStateLookup[connections]);
 }
示例#4
0
 public CellConnection(CellConnections cell, Func <Tile, Tile, bool> comparisonFunction)
 {
     Cell = cell;
     this.comparisonFunction = comparisonFunction;
 }
 public DownNeighbor(CellConnections neighborCell)
     : base(neighborCell, Connects)
 {
 }
 public RightNeighbor(CellConnections neighborCell)
     : base(neighborCell, Connects)
 {
 }