예제 #1
0
        public void OnBallInPlay(BallEventArgs e)
        {
            EventHandler ballInPlay = BallInPlay;

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
예제 #2
0
 void ball_BallInPlay(object sender, EventArgs e)
 {
     pitchNumber++;
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if ((ballEventArgs.Distance < 95) && (ballEventArgs.Trajectory < 60))
         {
             CatchBall();
         }
         else
         {
             CoverFirstBase();
         }
     }
 }
예제 #3
0
 void ball_BallInPlay(object sender, EventArgs e)
 {
     pitchNumber++;
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if (ballEventArgs.Distance > 400 && ballEventArgs.Trajectory > 30)
         {
             FanSays.Add("Pitch #" + pitchNumber
                         + ": Home run! I'm going for the ball!");
         }
         else
         {
             FanSays.Add("Pitch #" + pitchNumber + ": Woo-hoo! Yeah!");
         }
     }
 }
예제 #4
0
 public void PlayBall()
 {
     BallEventArgs ballEventArgs = new BallEventArgs(Trajectory, Distance);
     ball.OnBallInPlay(ballEventArgs);
 }
        public void PlayBall()
        {
            BallEventArgs ballEventArgs = new BallEventArgs(Trajectory, Distance);

            ball.OnBallInPlay(ballEventArgs);
        }
예제 #6
0
 public void OnBallInPlay(BallEventArgs e)
 {
     EventHandler ballInPlay = BallInPlay;
     if (ballInPlay != null)
         ballInPlay(this, e);
 }