예제 #1
0
 public void HitTheBall(BallEventArgs e)
 {
     if (hitBallCallback != null)
     {
         hitBallCallback(e);
     }
 }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            BallEventArgs ballEventArgs = new BallEventArgs((int)trajectoryNum.Value, (int)distanceNum.Value);
            //ball.OnBallInPlay(ballEventArgs);
            Bat bat = ball.GetNewBat();

            bat.HitTheBall(ballEventArgs);
        }
예제 #3
0
        protected void OnBallInPlay(BallEventArgs e)
        {
            EventHandler <BallEventArgs> ballInPlay = BallInPlay;

            if (ballInPlay != null)
            {
                ballInPlay(this, e);
            }
        }
예제 #4
0
파일: Fan.cs 프로젝트: zangeldar/EXERCISES
 void ball_BallInPlay(object sender, EventArgs e)
 {
     //throw new NotImplementedException();
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if ((ballEventArgs.Distance > 400) && (ballEventArgs.Trajectory > 30))
         {
             Console.WriteLine("Fan: Home run! I'm going for the ball!");
         }
         else
         {
             Console.WriteLine("Fan: Woo-hoo! Yeah!");
         }
     }
 }
예제 #5
0
 private void ball_BallInPlay(object sender, EventArgs e)
 {
     //throw new NotImplementedException();
     if (e is BallEventArgs)
     {
         BallEventArgs ballEventArgs = e as BallEventArgs;
         if ((ballEventArgs.Distance < 95) && (ballEventArgs.Trajectory < 60))
         {
             CatchBall();
         }
         else
         {
             CoverFirstBase();
         }
     }
 }