public MapView() { WidthRequest = _blockSize * ColCount; HeightRequest = _blockSize * RowCount; _grid = new SKColor[ColCount, RowCount]; Shape = Shape.CreateShape(new SKPointI(new Random().Next(Map.ColCount - Shape.PointsCount), 0)); }
private bool CheckBoundary(SKPointI[] points) { // left bound if ((from p in points select p.X).Min() < 0) { return(false); } // right bound if ((from p in points select p.X).Max() > Map.ColCount - 1) { return(false); } // bottom and overlayed foreach (var p in points) { if (p.Y > Map.RowCount - 1 || _grid[p.X, p.Y] != SKColor.Empty) { UpdateGrid(Shape); Shape = Shape.CreateShape(new SKPointI(new Random().Next(Map.ColCount - Shape.PointsCount), 0)); return(false); } } return(true); }