public void ActionHandle(BuffHandlerVar buffHandlerVar)
    {
#if !SERVER
        Buff_PlayEffect buff = (Buff_PlayEffect)buffHandlerVar.data;
        if (buff.lockToTarget)
        {
            if (!buffHandlerVar.GetBufferValue(out BufferValue_TargetUnits targetUnits))
            {
                return;
            }
            foreach (var v in targetUnits.targets)
            {
                PlayEffect_LockToTarget(v, buff, buffHandlerVar);
            }
        }
        else
        {
            if (!buffHandlerVar.GetBufferValue(out BufferValue_Pos pos))
            {
                Log.Debug("找不到位置");
                return;
            }
            PlayEffect(pos.aimPos, buff, buffHandlerVar);
        }
#endif
    }
示例#2
0
 static void AddEffectCache(EffectCacheComponent effectCacheComponent, BaseBuffData buff, GameObject skillAssetsPrefabGo)
 {
     if (buff.GetBuffIdType() == BuffIdType.EmitObj)
     {
         Buff_EmitObj buff_EmitEffect = (Buff_EmitObj)buff;
         if (!string.IsNullOrEmpty(buff_EmitEffect.emitObjId) && !effectCacheComponent.Contains(buff_EmitEffect.emitObjId))
         {
             effectCacheComponent.Add(buff_EmitEffect.emitObjId, skillAssetsPrefabGo.Get <GameObject>(buff_EmitEffect.emitObjId));
         }
     }
     if (buff.GetBuffIdType() == BuffIdType.HitEffect)
     {
         Buff_HitEffect buff_HitEffect = (Buff_HitEffect)buff;
         if (!string.IsNullOrEmpty(buff_HitEffect.hitObjId) && !effectCacheComponent.Contains(buff_HitEffect.hitObjId))
         {
             effectCacheComponent.Add(buff_HitEffect.hitObjId, skillAssetsPrefabGo.Get <GameObject>(buff_HitEffect.hitObjId));
         }
     }
     if (buff.GetBuffIdType() == BuffIdType.PlayEffect)
     {
         Buff_PlayEffect buff_PlayEffect = (Buff_PlayEffect)buff;
         if (!string.IsNullOrEmpty(buff_PlayEffect.effectObjId) && !effectCacheComponent.Contains(buff_PlayEffect.effectObjId))
         {
             effectCacheComponent.Add(buff_PlayEffect.effectObjId, skillAssetsPrefabGo.Get <GameObject>(buff_PlayEffect.effectObjId));
         }
     }
 }
    public void Remove(BuffHandlerVar buffHandlerVar)
    {
#if !SERVER
        Buff_PlayEffect buff = (Buff_PlayEffect)buffHandlerVar.data;
        if (buff.duration > 0)
        {
            return;
        }
        if (!buffHandlerVar.GetBufferValue(out BufferValue_TargetUnits targetUnits))
        {
            return;
        }
        foreach (var v in targetUnits.targets)
        {
            RemoveEffect(v.Id, buff.buffSignal, buff.effectObjId);
        }
#endif
    }
 public void PlayEffect(Vector3 target, Buff_PlayEffect buff, BuffHandlerVar buffHandlerVar)
 {
     AddEffect(buffHandlerVar.source, buff.buffSignal, buff.effectObjId, false, target + buff.posOffset.ToV3(), buff.canBeInterrupted, buffHandlerVar.cancelToken, buff.duration, buffHandlerVar.skillId).Coroutine();
 }
 public void PlayEffect_LockToTarget(Unit target, Buff_PlayEffect buff, BuffHandlerVar buffHandlerVar)
 {
     AddEffect(target, buff.buffSignal, buff.effectObjId, true, target.Position + buff.posOffset.ToV3(), buff.canBeInterrupted, buffHandlerVar.cancelToken, buff.duration, buffHandlerVar.skillId).Coroutine();
 }