```
feat(PlayerSkillSystem): 实现天雷狂轰技能特效和伤害机制 - 添加技能2特效配置,包括落雷击中特效和雷暴全屏光环特效 - 更新技能2名称从"全屏AOE伤害"为"全屏天雷狂轰伤害" - 实现屏幕中央触发全屏雷暴光环效果 - 添加交错落雷机制,对敌方单位进行精确打击 - 支持无敌人时在敌方阵地随机散落震撼天雷 - 优化伤害计算和冷却逻辑 - 同步更新技能日志信息和代码注释 ```
This commit is contained in:
1 parent
23c559d9f7
commit
8534d974a9
3 files changed
+87
-11
No files matched your search
Binary file not shown.
@@ -33,6 +33,10 @@ public class PlayerSkillSystem : MonoBehaviour
|
||||
public float skill2Damage = 80f;
|
||||
private float skill2RemainingCooldown = 0f;
|
||||
|
||||
[Header("技能2特效配置")]
|
||||
public GameObject lightningStrikePrefab; // 落雷击中特效 (Assets/TJGeneratorLibEffects/Prefabs/Combat/Explosions/LightningExplosion/LightningExplosionBlue.prefab)
|
||||
public GameObject lightningNovaPrefab; // 雷暴全屏光环特效 (Assets/TJGeneratorLibEffects/Prefabs/Combat/Nova/Lightning/NovaLightningBlue.prefab)
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
@@ -277,7 +281,7 @@ public class PlayerSkillSystem : MonoBehaviour
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用技能2:全屏AOE伤害
|
||||
/// 使用技能2:全屏天雷狂轰伤害
|
||||
/// </summary>
|
||||
public void UseSkill2()
|
||||
{
|
||||
@@ -287,32 +291,103 @@ public class PlayerSkillSystem : MonoBehaviour
|
||||
}
|
||||
|
||||
float finalDamage = skill2Damage * powerMultiplier;
|
||||
Debug.Log($"释放技能2:全屏AOE(造成 {finalDamage:F1} 伤害,威力倍率: {powerMultiplier:F2})");
|
||||
Debug.Log($"释放技能2:天雷狂轰(造成 {finalDamage:F1} 伤害,威力倍率: {powerMultiplier:F2})");
|
||||
|
||||
// 对所有敌方单位造成伤害
|
||||
var enemies = FindObjectsOfType<UnitBase>();
|
||||
int hitCount = 0;
|
||||
|
||||
foreach (var unit in enemies)
|
||||
// 加载特效资源
|
||||
GameObject strikePrefab = lightningStrikePrefab;
|
||||
#if UNITY_EDITOR
|
||||
if (strikePrefab == null)
|
||||
{
|
||||
strikePrefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>("Assets/TJGeneratorLibEffects/Prefabs/Combat/Explosions/LightningExplosion/LightningExplosionBlue.prefab");
|
||||
}
|
||||
#endif
|
||||
|
||||
GameObject novaPrefab = lightningNovaPrefab;
|
||||
#if UNITY_EDITOR
|
||||
if (novaPrefab == null)
|
||||
{
|
||||
novaPrefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>("Assets/TJGeneratorLibEffects/Prefabs/Combat/Nova/Lightning/NovaLightningBlue.prefab");
|
||||
}
|
||||
#endif
|
||||
|
||||
// 1. 屏幕中央触发全屏雷暴光环
|
||||
if (novaPrefab != null)
|
||||
{
|
||||
Vector3 centerPos = new Vector3(0f, 0.1f, 0f);
|
||||
var novaGo = Instantiate(novaPrefab, centerPos, novaPrefab.transform.rotation);
|
||||
Destroy(novaGo, 3.5f);
|
||||
}
|
||||
|
||||
// 2. 检索所有活着的敌方单位
|
||||
var allUnits = FindObjectsOfType<UnitBase>();
|
||||
var targetEnemies = new System.Collections.Generic.List<UnitBase>();
|
||||
|
||||
foreach (var unit in allUnits)
|
||||
{
|
||||
if (unit == null || !unit.gameObject.activeInHierarchy) continue;
|
||||
var team = unit.GetComponent<UnitTeam>();
|
||||
if (team != null && team.teamId == 1) // 敌方
|
||||
{
|
||||
var healthBar = unit.GetComponent<WorldHealthBar>();
|
||||
if (healthBar != null && !healthBar.IsDead)
|
||||
{
|
||||
healthBar.TakeDamage(finalDamage);
|
||||
hitCount++;
|
||||
targetEnemies.Add(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log($"全屏AOE命中 {hitCount} 个敌人");
|
||||
StartCoroutine(ExecuteLightningStrikesRoutine(targetEnemies, strikePrefab, finalDamage));
|
||||
|
||||
// 开始冷却
|
||||
skill2RemainingCooldown = skill2Cooldown * cooldownMultiplier;
|
||||
}
|
||||
|
||||
// TODO: 播放技能特效
|
||||
private System.Collections.IEnumerator ExecuteLightningStrikesRoutine(
|
||||
System.Collections.Generic.List<UnitBase> targetEnemies,
|
||||
GameObject strikePrefab,
|
||||
float finalDamage)
|
||||
{
|
||||
if (targetEnemies.Count > 0)
|
||||
{
|
||||
// 敌群交错落雷
|
||||
for (int i = 0; i < targetEnemies.Count; i++)
|
||||
{
|
||||
var enemy = targetEnemies[i];
|
||||
if (enemy != null && enemy.gameObject.activeInHierarchy)
|
||||
{
|
||||
Vector3 strikePos = enemy.transform.position;
|
||||
strikePos.y = 0.1f;
|
||||
|
||||
if (strikePrefab != null)
|
||||
{
|
||||
var strikeGo = Instantiate(strikePrefab, strikePos, strikePrefab.transform.rotation);
|
||||
Destroy(strikeGo, 3f);
|
||||
}
|
||||
|
||||
var healthBar = enemy.GetComponent<WorldHealthBar>();
|
||||
if (healthBar != null && !healthBar.IsDead)
|
||||
{
|
||||
healthBar.TakeDamage(finalDamage);
|
||||
}
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(0.08f); // 80毫秒交错落雷节奏
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 无敌人时在敌方阵地随机散落 6 道震撼天雷
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Vector3 randomPos = new Vector3(Random.Range(-5f, 5f), 0.1f, Random.Range(2f, 12f));
|
||||
if (strikePrefab != null)
|
||||
{
|
||||
var strikeGo = Instantiate(strikePrefab, randomPos, strikePrefab.transform.rotation);
|
||||
Destroy(strikeGo, 3f);
|
||||
}
|
||||
yield return new WaitForSeconds(0.08f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
- [2026-10-07 17:32:11] 召唤师技能治疗特效实现:使用 ParabolaFlyObject 驱动 GlowOrbGreen 飞球 (Assets/TJGeneratorLibEffects/Prefabs/Interactive/Loot/GlowOrb/GlowOrbGreen.prefab) 抛物线飞行至阵地中心,落地瞬间触发 2.5 倍缩放的 HealNova 粒子冲击波 (Assets/TJGeneratorLibEffects/Prefabs/Interactive/Healing/HealNova.prefab),并在此时调用 BuffSystem.Instance.ApplyGroupHeal 结算恢复。
|
||||
|
||||
- [2026-10-07 16:22:52] 法师技能与特效配置更新:法师 projectilePrefab 统一使用 FireballSharpMissileFire.prefab,并且命中落地触发 MagicExplosionFire.prefab 爆破,具体资产路径已同步更新至《召唤之战-角色与技能说明.md》。
|
||||
- [2026-10-08 00:04:53] 天雷狂轰技能实现:点击释放时在全屏中心激发 NovaLightningBlue 蓝闪电光环,同时按 80ms 节奏交错向全场敌方单位头顶劈下 LightningExplosionBlue 落雷(无敌人时在阵地随机轰炸 6 道),造成最终结算伤害并弹出漂字。具体路径与配置已同步写入项目。
|
||||
|
||||
### Reference
|
||||
- [2026-09-09 12:23:17] 飞行物脚本 Projectile.cs 负责锁敌追踪、碰撞检测和伤害结算。箭矢预制体 ArrowProjectile_White.prefab 已配置 Projectile 组件和 CapsuleCollider(Is Trigger)。远程单位需在攻击动画松弦帧添加 OnAttackEffect Event,并在 UnitBase 中设置 attackType=RangedProjectile、projectilePrefab、projectileSpawnPoint。
|
||||
Reference in new issue
Block a user