public void HitTheBall(BallEventArgs e) { if (hitBallCallback != null) { hitBallCallback(e); } }
public void PlayBall() { Bat bat = ball.GetNewBat(); BallEventArgs ballEventArgs = new BallEventArgs(Trajectory, Distance); bat.HitTheBall(ballEventArgs); }
protected void OnBallInPlay(BallEventArgs e) { EventHandler <BallEventArgs> ballInPlay = BallInPlay; if (ballInPlay != null) { ballInPlay(this, e); } }
private void Ball_BallInPlay(object sender, EventArgs e) { if (e is BallEventArgs) { BallEventArgs ballEventArgs = e as BallEventArgs; if ((ballEventArgs.Distance <= 400) && (ballEventArgs.Trajectory <= 30)) { FunSay(); } else { FunTryCatch(); } } }
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(); } } }