增加敌人攻击特效和音效

This commit is contained in:
2026-07-05 13:44:49 +08:00
parent aa9482875c
commit 4da7bdb9a4
5 changed files with 43 additions and 7 deletions
+5
View File
@@ -351,6 +351,11 @@ MonoBehaviour:
bellChaseTimeout: 10
bellPatrolTime: 5
bellPatrolRadius: 3
attackRange: 1.5
attackCooldown: 1.5
attackDamage: 1
attackAnimTrigger: Attack
attackParticlePrefab: {fileID: 1576508625749478, guid: a619fc9eccbe6d242a5a7f82bbb584be, type: 3}
--- !u!114 &2877034408413616420
MonoBehaviour:
m_ObjectHideFlags: 0
+21
View File
@@ -17351,6 +17351,7 @@ GameObject:
m_Component:
- component: {fileID: 1043014446}
- component: {fileID: 1043014445}
- component: {fileID: 1043014447}
m_Layer: 0
m_HasEditorInfo: 1
m_Name: EventSystem
@@ -17389,6 +17390,26 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1043014447
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1043014443}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!1 &1052525888
GameObject:
m_ObjectHideFlags: 0
+13 -3
View File
@@ -238,11 +238,21 @@ 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);
Vector3 spawnPos = transform.position;
// Z轴180°翻转修正特效方向
Quaternion fxRotation = transform.rotation * Quaternion.Euler(0, 0, 180);
GameObject fx = Instantiate(attackParticlePrefab, spawnPos, fxRotation);
// 预制体的 playOnAwake 关闭,需要手动播放粒子特效和音效
var ps = fx.GetComponent<ParticleSystem>();
if (ps != null) ps.Play();
var audio = fx.GetComponent<AudioSource>();
if (audio != null) audio.Play();
Destroy(fx, 2f);
}
}
+3 -3
View File
@@ -1,5 +1,6 @@
{
"dependencies": {
"com.ivanmurzak.unity.mcp": "0.82.4",
"com.unity.2d.sprite": "1.0.0",
"com.unity.collab-proxy": "2.11.3",
"com.unity.feature.development": "1.0.1",
@@ -38,8 +39,7 @@
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0",
"com.ivanmurzak.unity.mcp": "0.82.3"
"com.unity.modules.xr": "1.0.0"
},
"scopedRegistries": [
{
@@ -51,4 +51,4 @@
]
}
]
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"dependencies": {
"com.ivanmurzak.unity.mcp": {
"version": "0.82.3",
"version": "0.82.4",
"depth": 0,
"source": "registry",
"dependencies": {