Esempio n. 1
0
 public void Rotate(Part.RotationDirection direction)
 {
     //Rotates the tetris part, if it can
     if (CanRotate(direction))
     {
         current.Rotate(direction);
     }
 }
Esempio n. 2
0
 private bool CanRotate(Part.RotationDirection direction)
 {
     //Check if the tetris part can be rotated in a given direction
     Point[] preview = current.RotatePreview(direction);
     foreach (Point p in preview)
     {
         if (p.X < 0 || p.X >= Width || p.Y >= Height || gridcontent.ConvertAll <Point>(
                 delegate(ColorPoint cp)
         {
             return(cp.point);
         }
                 ).Contains(p))
         {
             return(false);
         }
     }
     return(true);
 }