示例#1
0
        public void PlayBall()
        {
            Bat           bat           = ball.GetNewBat();
            BallEventArgs ballEventArgs = new BallEventArgs(Trajectory, Distance);

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

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
示例#4
0
        protected void OnBallInPlay(BallEventArgs e)
        {
            EventHandler <BallEventArgs> ballInPlay = BallInPlay;

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
示例#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();
         }
     }
 }
示例#6
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)
         {
             FanSays.Add("Home run! I'm going for the ball!");
         }
         else
         {
             FanSays.Add("Woo-hoo! Yeah!");
         }
     }
 }
        private 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!");
                }
            }
        }
        public void PlayBall()
        {
            BallEventArgs ballEventArgs = new BallEventArgs(Trajectory, Distance);

            ball.OnBallInPlay(ballEventArgs);
        }