Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication2 {
- class Program {
- static void Main(string[] args) {
- var bat = new BallGame();
- // Start listening for the ball being hit...
- bat.BallHit += new EventHandler<BallHitEventArgs>(bat_BallHit);
- // ... and listen for the game being over...
- bat.GameOver += new EventHandler(bat_GameOver);
- // start the game...
- bat.HitBall(20, 359);
- Console.Read();
- }
- private static void bat_GameOver(object sender, EventArgs e) {
- Console.WriteLine("[SUBSCRIBER:] I have just been told that the game is over");
- }
- private static void bat_BallHit(object sender, BallHitEventArgs e) {
- Console.WriteLine("[SUBSCRIBER:] I have just been told that the ball was hit:" + e.Mph);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement