fix(editor): WeaponHitBoxWizard 补挂 WeaponFeedback——武器本地反馈链路接通

向导生成武器 HitBox Prefab 时在根节点添加 WeaponFeedback
(WeaponHitBoxInstance.Awake 经 GetComponentInChildren 获取)。
此前组件缺失,武器级命中/破风反馈静默落到 NullFeedbackPlayer。
MMF_Player 反馈链内容仍留待 Inspector 编排。存量
WPN_WPN_DiHun_HitBox.prefab 已另行补挂修正。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 11:59:35 +08:00
parent 09bdda970a
commit f7eb2d4368

View File

@@ -2,6 +2,7 @@ using System.IO;
using UnityEditor;
using UnityEngine;
using BaseGames.Combat;
using BaseGames.Feedback;
using BaseGames.Player;
namespace BaseGames.Editor.Combat
@@ -12,11 +13,14 @@ namespace BaseGames.Editor.Combat
///
/// 生成路径规范Assets/_Game/Prefabs/Weapons/WPN_{weaponId}_HitBox.prefab
/// Prefab 结构:
/// [WPN_{weaponId}_HitBox] ← WeaponHitBoxInstance
/// [WPN_{weaponId}_HitBox] ← WeaponHitBoxInstance + WeaponFeedback武器本地反馈命中粒子/音效/破风)
/// ├── [HitBox_Ground] ← Collider2D(IsTrigger, 形状可选) + HitBox, Layer=PlayerHitBox
/// ├── [HitBox_Up]
/// ├── [HitBox_Down]
/// └── [HitBox_Air]
///
/// WeaponFeedback 的 MMF_Player 反馈链留待 Inspector 编排;
/// 缺失该组件时 WeaponHitBoxInstance 会静默落到 NullFeedbackPlayer无武器级表现
/// </summary>
public class WeaponHitBoxWizard : ScriptableWizard
{
@@ -101,6 +105,9 @@ namespace BaseGames.Editor.Combat
// ── 构建 Prefab ────────────────────────────────────────────────
var root = new GameObject(prefabName);
var instance = root.AddComponent<WeaponHitBoxInstance>();
// 武器本地反馈WeaponHitBoxInstance.Awake 经 GetComponentInChildren<IFeedbackPlayer>() 获取);
// MMF_Player 反馈链留待 Inspector 编排
root.AddComponent<WeaponFeedback>();
var so = new SerializedObject(instance);
void AddDirection(bool enabled, string nodeName, string fieldName, ColliderShape shape)