增加敌人攻击动作v0.1

This commit is contained in:
2026-07-04 19:42:39 +08:00
parent 4375e97cd7
commit 00499e552f
7 changed files with 38 additions and 2 deletions
+11
View File
@@ -73,6 +73,9 @@ namespace IndianOceanAssets.Engine2_5D
[Tooltip("攻击动画触发器名称(Animator Trigger")]
[SerializeField] private string attackAnimTrigger = "Attack";
[Tooltip("攻击时播放的粒子特效预制体")]
[SerializeField] private GameObject attackParticlePrefab;
// 状态枚举
private enum State
{
@@ -234,6 +237,14 @@ namespace IndianOceanAssets.Engine2_5D
{
_animator.SetTrigger(attackAnimTrigger);
}
// 播放攻击粒子特效(生成在玩家位置,模拟命中效果)
if (attackParticlePrefab != null)
{
Vector3 spawnPos = playerTarget != null ? playerTarget.position : transform.position;
GameObject fx = Instantiate(attackParticlePrefab, spawnPos, transform.rotation);
Destroy(fx, 2f);
}
}
// ===== ChasingBell:追击铃铛 =====