Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Bat           bat           = ball.GetNewBat();
            BallEventArgs ballEventArgs = new BallEventArgs((int)numericUpDown1.Value, (int)numericUpDown2.Value);

            bat.HitTheBall(ballEventArgs);
        }
Esempio n. 2
0
 public void HitTheBall(BallEventArgs e)
 {
     if (hitBallCallback != null)
     {
         hitBallCallback(e);
     }
 }
Esempio n. 3
0
        protected void OnBallInPlay(BallEventArgs e)
        {
            EventHandler ballInPlay = BallInPlay;

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
Esempio n. 4
0
 private void Ball_BallInPlay(object sender, EventArgs e)
 {
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if ((ballEventArgs.Distance > 400) && ballEventArgs.Trajectory > 30)
         {
             GrabGlove();
         }
         else
         {
             Yell();
         }
     }
 }
Esempio n. 5
0
 private void Ball_BallInPlay(object sender, EventArgs e)
 {
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if ((ballEventArgs.Distance < 95) && ballEventArgs.Trajectory < 60)
         {
             CatchBall();
         }
         else
         {
             CoverFirstBase();
         }
     }
 }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            BallEventArgs ballEventArgs = new BallEventArgs((int)numericUpDown1.Value, (int)numericUpDown2.Value);

            ball.OnBallInPlay(ballEventArgs);
        }