Example #1
0
    public void ActionHandle(BuffHandlerVar buffHandlerVar)
    {
        Buff_HitEffect buff = (Buff_HitEffect)buffHandlerVar.data;

        if (buffHandlerVar.GetBufferValue(out BufferValue_TargetUnits targets))
        {
            foreach (var v in targets.targets)
            {
                //未造成伤害就不给予效果
                if (buffHandlerVar.GetBufferValue(out BufferValue_AttackSuccess attackSuccess))
                {
                    if (attackSuccess.successDic.ContainsKey(v.Id))
                    {
                        if (!attackSuccess.successDic[v.Id])
                        {
                            continue;
                        }
                    }
                }
                HitEffect(buff, v.Position, buffHandlerVar.skillId);
            }
            return;
        }
        if (!buffHandlerVar.GetBufferValue(out BufferValue_Pos value_Pos))
        {
            return;
        }
        HitEffect(buff, value_Pos.aimPos, buffHandlerVar.skillId);
    }
Example #2
0
    public void HitEffect(Buff_HitEffect buff, Vector3 pos, string skillId)
    {
#if !SERVER
        PlayHitEffect(buff.hitObjId, pos + buff.posOffset.ToV3(), buff.duration).Coroutine();
#else
        bool          isInApplyData = false;
        BaseSkillData baseSkillData = SkillHelper.GetBaseSkillData(skillId);
        foreach (var v in baseSkillData.applyDatas)
        {
            PipelineDataWithBuff pipelineDataWithBuff = v as PipelineDataWithBuff;
            if (pipelineDataWithBuff != null)
            {
                if (pipelineDataWithBuff.buffs.Find(b => b.buffData.buffSignal == buff.buffSignal) != null)
                {
                    isInApplyData = true;
                    break;
                }
            }
        }
        if (!isInApplyData)
        {
            return;
        }
        M2C_HitEffect m2C = new M2C_HitEffect();
        m2C.Duration = buff.duration;
        m2C.HitObjId = buff.hitObjId;
        m2C.Pos      = (pos + buff.posOffset.ToV3()).ToV3Info();
        ETHotfix.MessageHelper.Broadcast(m2C);
#endif
    }
Example #3
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));
         }
     }
 }