Пример #1
0
 void LateUpdate()
 {
     if (isActivated == false)
     {
         return;
     }
     foreach (var item in players)
     {
         if (item == null)
         {
             continue;
         }
         BuffReceiver receiver = item.GetComponent <BuffReceiver>();
         if (receiver.gameObject == null)
         {
             return;
         }
         if (receiver.buffs.Any(p => p.buffType == buff.buffType) == true)
         {
             if (receiver.gameObject == null)
             {
                 return;
             }
             return;
         }
         if (receiver.buffs.Any(p => p.ID == buff.ID) == false)
         {
             receiver.AddBuff(buff);
         }
     }
 }
Пример #2
0
 public override void Activate(GameObject actor, GameObject target)
 {
     base.Activate(actor, target);
     if (target.GetComponent <BuffReceiver>())
     {
         BuffReceiver receiver = target.GetComponent <BuffReceiver>();
         if (receiver.buffs.Any(item => item.buffType == buff.buffType) == true)
         {
             //BaseBuff temp = receiver.buffs.First(item => item.buffType == buff.buffType);
             foreach (var item in receiver.buffs.ToArray())
             {
                 if (item.buffType == buff.buffType)
                 {
                     item.Activate(receiver);
                     receiver.RemoveBuff(item);
                 }
             }
             //temp.Activate(receiver);
         }
         if (receiver.buffs.Any(item => item.ID == buff.ID) == false)
         {
             receiver.AddBuff(buff);
         }
     }
 }
Пример #3
0
    public void OnTriggerStay2D(Collider2D col)
    {
        if (buff == null)
        {
            return;
        }
        BuffReceiver receiver = col.gameObject.GetComponent <BuffReceiver>();

        if (receiver == null)
        {
            return;
        }
        if (receiver.GetComponent <PlayerController>().ID == 5)
        {
            return;
        }
        if (receiver.buffs.Any(p => p.ID == buff.ID) == false)
        {
            receiver.AddBuff(buff);
        }
    }