示例#1
0
    public void OnNotification(object sender, Message msg, params object[] args)
    {
        bool senderIsOwner = (Object)sender == owner;

        if (!senderIsOwner)
        {
            return;
        }

        switch (msg)
        {
        case Message.Combat_HealthChange:
            float diff = (float)args[0];
            accumulatedDamage += Mathf.Abs(diff);
            damageText.enabled = true;
            damageText.text    = Mathf.CeilToInt(accumulatedDamage).ToString();
            textDisappear.Start();
            break;
        }
    }
示例#2
0
 public void OnNotification(object sender, Message msg, params object[] args)
 {
     if (owner.IsInAnyState(States.Dead))
     {
         UIElementCanvas.enabled = false;
         return;
     }
     if (msg == Message.Combat_LockOnTarget)
     {
         var target = (Character)args[0];
         if (target == owner)
         {
             UIElementCanvas.enabled = true;
             disableUITimer.Stop();
         }
         else
         {
             if (!disableUITimer.IsCounting())
             {
                 UIElementCanvas.enabled = false;
             }
         }
     }
     else if (msg == Message.Combat_HealthChange && (Object)sender == owner)
     {
         if (!UIElementCanvas.enabled)
         {
             UIElementCanvas.enabled = true;
             disableUITimer.Start();
         }
     }
     else if (msg == Message.Combat_Death && (Object)sender == owner)
     {
         UIElementCanvas.enabled = false;
     }
 }