public override void Link(Cell cell, bool bidirectional = true) { var overcell = (OverCell)cell; OverCell neighbor = null; if (North != null && North == overcell.South) { neighbor = (OverCell)North; } if (South != null && South == overcell.North) { neighbor = (OverCell)South; } if (East != null && East == overcell.West) { neighbor = (OverCell)East; } if (West != null && West == overcell.East) { neighbor = (OverCell)West; } if (neighbor != null) { _grid.TunnelUnder(neighbor); } else { base.Link(cell, bidirectional); } }
public UnderCell(OverCell overCell) : base(overCell.Row, overCell.Column, null) { if (overCell.HorizontalPassage) { North = overCell.North; overCell.North.South = this; South = overCell.South; overCell.South.North = this; Link(North); Link(South); } else { East = overCell.East; overCell.East.West = this; West = overCell.West; overCell.West.East = this; Link(East); Link(West); } }