-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPitcher.cs
More file actions
45 lines (41 loc) · 1.2 KB
/
Pitcher.cs
File metadata and controls
45 lines (41 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EventApp
{
class Pitcher
{
public Pitcher(Ball ball)
{
//ball.BallInPlay += new EventHandler(ball_BallInPlay);
ball.BallInPlay += ball_BallInPlay;
}
public 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();
//ballEventArgs.Distance = 0;
//ballEventArgs.Trajectory
}
//int th = System.Threading.Thread.CurrentThread.ManagedThreadId;
//Console.WriteLine("n° thread : " + th);
}
private void CoverFirstBase()
{
Console.WriteLine("Pitcher : I covered first base");
}
private void CatchBall()
{
Console.WriteLine("Pitcher : I caught the ball");
}
}
}