diff --git a/unity/Assets/2.5D Engine/Enemy.prefab b/unity/Assets/2.5D Engine/Enemy.prefab index d50e02d..7841bf5 100644 --- a/unity/Assets/2.5D Engine/Enemy.prefab +++ b/unity/Assets/2.5D Engine/Enemy.prefab @@ -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 diff --git a/unity/Assets/Scenes/Gameplay.unity b/unity/Assets/Scenes/Gameplay.unity index c73fdb1..f22642e 100644 --- a/unity/Assets/Scenes/Gameplay.unity +++ b/unity/Assets/Scenes/Gameplay.unity @@ -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 diff --git a/unity/Assets/enemy/EnemyAI.cs b/unity/Assets/enemy/EnemyAI.cs index 9f22e3b..0205fcf 100644 --- a/unity/Assets/enemy/EnemyAI.cs +++ b/unity/Assets/enemy/EnemyAI.cs @@ -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(); + if (ps != null) ps.Play(); + + var audio = fx.GetComponent(); + if (audio != null) audio.Play(); + Destroy(fx, 2f); } } diff --git a/unity/Packages/manifest.json b/unity/Packages/manifest.json index fff1caa..e094211 100644 --- a/unity/Packages/manifest.json +++ b/unity/Packages/manifest.json @@ -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 @@ ] } ] -} \ No newline at end of file +} diff --git a/unity/Packages/packages-lock.json b/unity/Packages/packages-lock.json index 8a0adfa..17d07e1 100644 --- a/unity/Packages/packages-lock.json +++ b/unity/Packages/packages-lock.json @@ -1,7 +1,7 @@ { "dependencies": { "com.ivanmurzak.unity.mcp": { - "version": "0.82.3", + "version": "0.82.4", "depth": 0, "source": "registry", "dependencies": {