Esempio n. 1
0
 //Move the block of aliens
 public void Move()
 {
     if (right)
     {
         //If rightMostAlien can move right then move all rows right
         if (rightMostAlien.CanMoveRight())
         {
             foreach (RowOfAliens row in block)
             {
                 row.MoveRowRight();
             }
         }
         //Else move the block down and change direction
         else
         {
             MoveBlockDown();
             right = false;
         }
     }
     else
     {
         //If leftMostAlien can move left then move all rows left
         if (leftMostAlien.CanMoveLeft())
         {
             foreach (RowOfAliens row in block)
             {
                 row.MoveRowLeft();
             }
         }
         //Else move the block down and change direction
         else
         {
             MoveBlockDown();
             right = true;
         }
     }
 }