Esempio n. 1
0
 /// <summary>
 /// create new figure,
 /// and move it down with reading user input
 /// and trying to do what user wants
 /// </summary>
 void Update()
 {
     if (DoUpdate)
     {
         if (NewFigure)
         {
             glass.RemoveRows();
             CurrentFig   = figures.Select();
             CurrentFig.x = glass.Width / 2;
             CurrentFig.y = 2;
             if (checker.Overlay(CurrentFig))
             {
                 GameOver = true;
             }
             NewFigure = false;
         }
         else
         {
             glass.PutFigure(CurrentFig, Color.white);
             Input = userInput.CheckUserInput();
             CurrentFig.TryMove(Input);
             if (checker.Sides(CurrentFig, Mode) || checker.SidesY(CurrentFig) || checker.Overlay(CurrentFig))
             {
                 CurrentFig.Rollback(Input);
             }
             if (checker.Fix(CurrentFig))
             {
                 NewFigure = true;
             }
             glass.PutFigure(CurrentFig, CurrentFig.color);
         }
     }
 }