示例#1
0
 /// <summary>
 /// Tick event for the timer. Handles much of the animation and physics. This also handles the forms,
 /// whether to close the current form or create a new gameplay form.
 ///
 /// Author John Santias and Hoang Nguyen October 2017
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void formTimer_Tick(object sender, EventArgs e)
 {
     currentGame.ProcessEffects();
     if (!currentGame.ProcessEffects())
     {
         currentGame.Gravity();
         DrawBackground();
         DrawGameplay();
         displayPanel.Invalidate();
         if (currentGame.Gravity())
         {
             return;
         }
         else
         {
             formTimer.Enabled = false;
             bool turnOver = currentGame.TurnOver();
             NewTurn();
             spacePressed = false;                     //prevents the player from pressing the space bar multiple times
             if (!turnOver)
             {
                 if (currentGame.GetRound() >= currentGame.GetTotalRounds())
                 {
                     currentGame.NextRound();
                     Dispose();
                 }
                 else
                 {
                     Dispose();
                     currentGame.NextRound();
                     return;
                 }
             }
         }
     }
     else
     {
         DrawGameplay();
         displayPanel.Invalidate();
         return;
     }
 }
示例#2
0
 /// <summary>
 /// Tick event for the timer. Handles much of the animation and physics. This also handles the forms,
 /// whether to close the current form or create a new gameplay form.
 ///
 /// Author John Santias and Hoang Nguyen October 2017
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void formTimer_Tick(object sender, EventArgs e)
 {
     currentGame.ProcessEffects();
     if (currentGame.ProcessEffects() == false)
     {
         currentGame.Gravity();
         DrawBackground();
         DrawGameplay();
         displayPanel.Invalidate();
         if (currentGame.Gravity())
         {
             return;
         }
         else
         {
             formTimer.Enabled = false;
             bool turnOver = currentGame.TurnOver();
             NewTurn();
             if (!turnOver)
             {
                 Dispose();
                 currentGame.NextRound();
                 if (currentGame.GetRound() > currentGame.GetTotalRounds())
                 {
                     Dispose();
                 }
                 return;
             }
         }
     }
     else
     {
         DrawGameplay();
         displayPanel.Invalidate();
         return;
     }
 }