Ejemplo n.º 1
0
 private void TimeWatcher_Tick(object sender, EventArgs e)
 {
     if (Tmins == 0 && Tsecs == 0)
     {
         TimeWatcher.Stop();
         EnemiesMover.Stop();
         BulletChecker.Stop();
         IntersectionsDetecter.Stop();
         this.KeyDown  -= new KeyEventHandler(Level1_KeyDown);
         StartStop.Text = "Start";
         Tsecs          = 2;
         Tmins          = 0;
         ClearCurrentWindow();
         if (IScore >= 3000)
         {
             GameResult("Winner");
         }
         else
         {
             GameResult("Loser");
         }
         return;
     }
     else if (Tmins >= 1 && Tsecs == 0)
     {
         Tmins--;
         Tsecs = 59;
     }
     else if (Tsecs > 0)
     {
         Tsecs--;
     }
     UpdateTime();
 }
Ejemplo n.º 2
0
        void GameResult(string result)
        {
            IntersectionsDetecter.Stop();
            TimeWatcher.Stop();
            EnemiesMover.Stop();
            RandomEnemyBullets.Stop();
            Form2 f = new Form2(result);

            f.Show();
        }
Ejemplo n.º 3
0
 private void StartStopGame(object sender, EventArgs e)
 {
     if (StartStop.Text == "Start")
     {
         StartStop.Text = "Pause";
         if (Level == 1)
         {
             if (start)
             {
                 EnemiesSpawner();
                 start = false;
             }
             IntersectionsDetecter.Start();
             TimeWatcher.Start();
             EnemiesMover.Start();
             BulletChecker.Start();
             ScoreTimePan.Click += new EventHandler(BulletMaker);
             this.Click         += new EventHandler(BulletMaker);
             this.KeyDown       += new KeyEventHandler(Level1_KeyDown);
             this.ActiveControl  = null;
         }
         else
         {
             if (start)
             {
                 EnemiesSpawner();
                 start = false;
             }
             IntersectionsDetecter.Start();
             EnemiesMover.Start();
             BulletChecker.Start();
             ScoreTimePan.Click += new EventHandler(BulletMaker);
             this.Click         += new EventHandler(BulletMaker);
             this.KeyDown       += new KeyEventHandler(Level1_KeyDown);
             this.ActiveControl  = null;
             RandomEnemyBullets.Start();
             WinOrLose.Start();
         }
     }
     else
     {
         StartStop.Text = "Start";
         if (Level == 1)
         {
             IntersectionsDetecter.Stop();
             TimeWatcher.Stop();
             EnemiesMover.Stop();
             BulletChecker.Stop();
             ScoreTimePan.Click -= new EventHandler(BulletMaker);
             this.Click         -= new EventHandler(BulletMaker);
             this.KeyDown       -= new KeyEventHandler(Level1_KeyDown);
         }
         else
         {
             IntersectionsDetecter.Stop();
             EnemiesMover.Stop();
             BulletChecker.Stop();
             ScoreTimePan.Click -= new EventHandler(BulletMaker);
             this.Click         -= new EventHandler(BulletMaker);
             this.KeyDown       -= new KeyEventHandler(Level1_KeyDown);
             this.ActiveControl  = null;
             RandomEnemyBullets.Stop();
             WinOrLose.Stop();
         }
     }
 }