private IEnumerator ShowHurtEffect(TeamDisplay targetTeam, float delayFrame) { yield return(new WaitForSeconds(FightServiceDef.FRAME_INTERVAL_TIME_F * delayFrame)); ShipDisplay targetShip = targetTeam.GetHurtShip(); if (targetTeam == null) { yield break; } if (AttackTrans_ == null) { yield break; } if (targetShip == null) { yield break; } Transform trans = targetShip.GetTransformByName(targetShip.GetHitPoint(AttackTrans_.position.x, SpellType_)); if (trans == null) { trans = targetShip.Trans; } Global.ShowHurtEffect(trans, HurtEffect_, trans.position); }
/// <summary> /// 子弹 /// </summary> /// <param name="attackShipTrans"></param> /// <param name="attackPartTrans"></param> /// <param name="target"></param> /// <param name="attackPart"></param> /// <param name="part"></param> /// <param name="delayTime"></param> public static void ShowBullet(float srcX, Transform attackPartTrans, List <BulletTarget> targetList, ClientParts attackPart, SpellType spellType, string bulletPath, Effect hurtEffect, Vector3 position, ClientSkill skill) { // 范围攻击特殊处理 if (spellType == SpellType.AOE) { BulletDisplay display = InitBullet(attackPartTrans, null, null, spellType, bulletPath, hurtEffect); if (display == null) { return; } display.SetAOE(targetList, position, skill); return; } // 其他攻击,一个子弹只对应一个目标 if (targetList.Count != 1) { return; } if (targetList[0].Target == null) { return; } ShipDisplay targetShip = targetList[0].Target.GetHurtShip(); if (targetShip == null) { return; } float delayTime = FightServiceDef.FRAME_INTERVAL_TIME_F * targetList[0].delayFrame; Transform targetTrans = targetShip.GetTransformByName(targetShip.GetHitPoint(srcX, spellType)); if (targetTrans == null) { targetTrans = targetShip.Trans; } // 导弹特殊处理,从左右发子弹 if (spellType == SpellType.Missile) { // TODO: 临时增加逻辑,防御节点一边扔3颗导弹 // 后面要考虑走配置 int missileCout = 1; if (attackPart.Owner.Reference.unitstrait == Def.ShipTrait.DefenseBuild) { missileCout = 3; } for (int i = 0; i < missileCout; i++) { BulletDisplay display = InitBullet(attackPartTrans, targetShip, targetTrans, spellType, bulletPath, hurtEffect); if (display == null) { return; } display.SetMissile(attackPartTrans.name.Contains("left"), delayTime); } } // 机枪特殊处理,做成扫射效果 else if (spellType == SpellType.MachineGun) { for (int i = 0; i < attackPart.Reference.continuity_times; i++) { BulletDisplay display = InitBullet(attackPartTrans, targetShip, targetTrans, spellType, bulletPath, hurtEffect); display.SetGun(delayTime, (float)attackPart.Reference.continuity_interval / 1000f * i); } } else { BulletDisplay display = InitBullet(attackPartTrans, targetShip, targetTrans, spellType, bulletPath, hurtEffect); display.SetLaserOrConnon(delayTime); } }