void Mark(IEnumerable <Vector2> points, Cell.States state) { foreach (var point in points.Where(IsInBounds)) { cells[point.X, point.Y].State = state; } DistancesCalculator.Update(AllCoords, this); }
void Mark(Vector2 point, Cell.States state) { cells[point.X, point.Y].State = state; var subjectPoints = Enumerable.Range(0, Width) .Select(x => new Vector2(x, point.Y)) .Union(Enumerable.Range(0, Height) .Select(y => new Vector2(point.X, y))); DistancesCalculator.Update(subjectPoints, this); }
void InitCells(int width, int height) { for (var x = 0; x < width; x++) { for (var y = 0; y < height; y++) { cells[x, y] = InitCell(new Vector2(x, y)); } } DistancesCalculator.Update(AllCoords, this); }