public void OnShoot() { if (KillingCompleted != null) { KillingCompleted.Invoke(this, EventArgs.Empty); Console.WriteLine("shooting......."); } }
//3.Alcanzar el evento public void OnShoot() { if (KillingCompleted == null) { return; } KillingCompleted.Invoke(this, new ShooterEventArgs(Name, Shots)); }
public void OnShoot() { while (true) { if ((rng.Next(0, 100) % 2) == 0) { if (KillingCompleted != null) { KillingCompleted.Invoke(this, EventArgs.Empty); } } else { Console.WriteLine("missed"); } Thread.Sleep(500); } }