Exemplo n.º 1
0
 public void RemoveHealthBelowZeroEventHandler(HealthBelowZeroEventHandler healthBelowZeroEventHandler)
 {
     if (healthBelowZeroEvent != null)
     {
         healthBelowZeroEvent -= healthBelowZeroEventHandler;
     }
 }
Exemplo n.º 2
0
    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;
        }
    }