Example #1
0
 public bool checkCorrectness(string typed)
 {
     for (int i = 0; i < observers.Count; ++i)
     {
         PlaneText textOnPlane = (PlaneText)observers[i];
         if (textOnPlane.Y < 100)
         {
             continue;
         }
         else
         {
             if (textOnPlane.Text.Length < typed.Length)
             {
                 continue;
             }
             else if (typed == (textOnPlane.Text).Substring(0, typed.Length))
             {
                 ((PlaneText)textOnPlane).highLight(typed);
                 if (typed.Length == textOnPlane.Text.Length)
                 {
                     ((PlaneText)textOnPlane).incMessageSize();
                     missiles.Push(new Missile());
                     missiles.Peek().makeCollide((PlaneText)textOnPlane);
                     missiles.Pop();
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Example #2
0
        public void setUpGame()
        {
            textProcessor = new TextProcessor();

            for (int i = 0; i < 10; ++i)
            {
                PlaneText planetext = new PlaneText(new Plane());
            }
            foreach (PlaneText planeText in PlaneText.planesAndTexts)
            {
                textProcessor.registerObserver(planeText);
            }
            textProcessor.timer_Imp(true);

            textbox    = new TextArea();
            scoreText  = new ScoreText();
            resultText = new ResultText();
            timerText  = new TimerText();
            planeCount = new PlaneCount();

            gameTimer.Start();
            counterDownTimer.Start();
        }
Example #3
0
 public void makeCollide(PlaneText planeandText)
 {
     state        = State.APPROACH;
     collidedText = planeandText;
     Y            = collidedText.Y;
 }