IEnumerator buildHurt(UnitCtl unit, EffectParameter effectInfo) { yield return(new WaitForSeconds(0.8f)); if (effectInfo.effect.animPathEnd != "temp") { GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathEnd); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefab); effectAnim.transform.position = unit.transform.position; } DamageVO damageVo = War.skillWarManager.GetDamageParameter(effectInfo.value, false, DamageType.ATTACK, unit, effectInfo.caster); unit.Damage(damageVo); }
//伤害单个 IEnumerator autoHurtBuildAllHurtSingle(SkillParameter skillParameter, EffectParameter effectInfo, UnitCtl unit, bool needDealSkill2) { yield return(new WaitForSeconds(0)); int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid); if (lengion == unit.unitData.legionId) { yield break; } float hurtValue = effectInfo.value; if (effectInfo.effect.type == (int)eSKillWarEffectType.eEffectHurtBuidingMax) { hurtValue = unit.unitData.maxHp * effectInfo.value / 100; } else if (effectInfo.effect.type == (int)eSKillWarEffectType.eEffectHurtRate) { Debug.LogFormat("=================hp:{0} value:{1}", unit.unitData.hp, effectInfo.value); hurtValue = unit.unitData.hp * effectInfo.value / 100; } DamageVO damageVo = War.skillWarManager.GetDamageParameter(hurtValue, false, DamageType.ATTACK, unit, effectInfo.caster); unit.Damage(damageVo, 0f, 0.2f, effectInfo.effect.hurtCount); //War.skillWarManager.soldierDieSHow(unit); //处理技能2 if (needDealSkill2 == true && skillParameter.curDealSkillIdx == 1) { Debug.LogFormat("=====needDealSkill2 true====="); War.skillWarManager.dealSkill2Effect(skillParameter); } if (effectInfo.effect.time > 0) { //War.skillWarManager.StartCoroutine(autoHurtBuildAllTimer(skillParameter, unit)); BuildSkillDots skillDots = unit.GetComponent <BuildSkillDots>(); if (skillDots != null) { skillDots.GetSkillHurt(effectInfo); } } Debug.Log(string.Format("<color=yellow> autoHurtBuildAllHurtSingle all=skill id:{0}, lvl:{1} v:{2} effecttime:{3}</color>", skillParameter.skillId, skillParameter.skillLvl, effectInfo.value, effectInfo.effect.time)); }
//定时伤害 IEnumerator autoHurtBuildAllTimer(EffectParameter effectInfo) { UnitCtl unit = gameObject.GetComponent <UnitCtl>(); effectInfo.waitTime = effectInfo.effect.time; DelayDestory destoryTimer = effectInfo.effectAnim.GetComponent <DelayDestory>(); if (destoryTimer != null) { destoryTimer.DelayTime = effectInfo.waitTime; } int timerCount = 0; //SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId); while (true) { yield return(new WaitForSeconds(1.0f)); try { DamageVO damageVo = War.skillWarManager.GetDamageParameter(effectInfo.value, false, DamageType.ATTACK, unit, effectInfo.caster); unit.Damage(damageVo); Debug.Log(string.Format("<color=yellow> autoHurtBuildAllTimer all= effectid:{0} </color>", effectInfo.effect.id)); timerCount++; if (timerCount >= effectInfo.waitTime) { break; } } catch (Exception e) { if (Application.isEditor) { Debug.LogError(e); } break; } } effectInfo.waitTime = 0; CleanList(); Debug.Log(string.Format("<color=white> autoHurtBuildAllTimer done=</color>")); }