public void RemoveHealthBelowZeroEventHandler(HealthBelowZeroEventHandler healthBelowZeroEventHandler) { if (healthBelowZeroEvent != null) { healthBelowZeroEvent -= healthBelowZeroEventHandler; } }
protected void AddHealthBelowZeroEventHandler(HealthBelowZeroEventHandler newEvent) // 이벤트에 추가된 적 없는 이벤트면 추가. { if (healthBelowZeroEvent == null) { healthBelowZeroEvent += newEvent; return; } System.Delegate[] invocations = healthBelowZeroEvent.GetInvocationList(); bool isNew = true; for (int i = 0; i < invocations.Length; i++) { if (invocations[i].Target == newEvent.Target) { isNew = false; } } if (isNew) { healthBelowZeroEvent += newEvent; } }