private void InitializeExternalCells() { for (Int32 yCell = bottom - offsetOnBottom; yCell < top + offsetOnTop; yCell++) { var xLeftCell = left - offsetOnLeft; var xRightCell = right + offsetOnRight; this[xLeftCell, yCell] = new CellCityBackground(this, xLeftCell, yCell) { IsFlooded = true }; this[xRightCell, yCell] = new CellCityBackground(this, xRightCell, yCell) { IsFlooded = true }; } for (Int32 xCell = left - offsetOnLeft; xCell < right + offsetOnRight; xCell++) { var yBottomCell = bottom - offsetOnBottom; var yTopCell = top + offsetOnTop; this[xCell, yBottomCell] = new CellCityBackground(this, xCell, yBottomCell) { IsFlooded = true }; this[xCell, yTopCell] = new CellCityBackground(this, xCell, yTopCell) { IsFlooded = true }; } }
private void InitializeInternalCells() { for (Int32 xCell = left; xCell <= right; xCell++) { for (Int32 yCell = bottom; yCell <= top; yCell++) { this[xCell, yCell] = new CellCityBackground(this, xCell, yCell); } } }
private Boolean CellIsFloodedAndNotExistBarrier(CellCityBackground cell, List <Wall> existingWalls, Wall barrier) => cell.IsFlooded && !existingWalls.Exists(w => w.Contains(barrier));