protected virtual void OnDeath(JumpmanDeathEventArgs e) { EventHandler <JumpmanDeathEventArgs> handler = Death; if (handler != null) { handler(this, e); } }
/// <summary> /// Kill the jumpman, removing him from the environment. /// <param name="reason">A debug message as to the cause of death.</param> /// </summary> public void Die(string reason) { JumpmanDeathEventArgs args = new JumpmanDeathEventArgs(); args.Deceased = this; args.DeathReason = reason; args.TimeOfDeath = environment.Time; OnDeath(args); environment.RemoveObject(this); }