Exemple #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (currentGame.ProcessWeaponEffects() == false)
     {
         currentGame.GravityStep();
         DrawBackground();
         DrawGameplay();
         displayPanel.Invalidate();
         if (currentGame.GravityStep() == true)
         {
             return;
         }
         else
         {
             timer1.Enabled = false;
             if (currentGame.FinishTurn() == true)
             {
                 NewTurn();
             }
             else
             {
                 Dispose();
                 currentGame.NextRound();
                 return;
             }
         }
     }
     else
     {
         DrawGameplay();
         displayPanel.Invalidate();
         return;
     }
 }
Exemple #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Debug.WriteLine("TimerEventProcessor start");

            if (!currentGame.ProcessWeaponEffects())
            {
                Debug.WriteLine("if (!currentGame.ProcessWeaponEffects())");
                currentGame.CalculateGravity();
                DrawBackground();
                DrawGameplay();
                displayPanel.Invalidate();


                if (currentGame.CalculateGravity())
                {
                    Debug.WriteLine("return calculated gravity");
                    return;
                }
                else
                {
                    Debug.WriteLine("disable timer");
                    timer1.Enabled = false;

                    if (currentGame.TurnOver())
                    {
                        NewTurn();

                        Debug.WriteLine("Newturn done");
                    }
                    else
                    {
                        Debug.WriteLine("turn over not done");
                        Dispose();
                        currentGame.NextRound();
                        return;
                    }
                }
            }
            else
            {
                Debug.WriteLine("else processing");
                DrawGameplay();
                displayPanel.Invalidate();
                return;
            }
        }