Esempio n. 1
0
        bool CanSet(Tetrimino tetrimino, int gapX, int gapY)
        {
            for (var x = 0; x < tetrimino.Width; x++)
            {
                for (var y = 0; y < tetrimino.Height; y++)
                {
                    var color = tetrimino.TetriminoColors[x, y];
                    if (color == TetriminoColor.None)
                    {
                        continue;
                    }

                    var fieldX = tetrimino.X + x + gapX;
                    var fieldY = tetrimino.Y + y + gapY;
                    if (field.Height <= fieldY)
                    {
                        continue;
                    }

                    if (fieldX < 0 || field.Width <= fieldX || fieldY < 0)
                    {
                        return(false);
                    }


                    if (field.Colors[fieldX, fieldY] == TetriminoColor.None)
                    {
                        continue;
                    }


                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
 public bool CanMove(Tetrimino tetrimino, int x, int y)
 {
     return(CanSet(tetrimino, x, y));
 }