This commit is contained in:
2026-10-06 23:36:39 +08:00
parent 8592b9366c
commit 499eea39aa
10 changed files with 1445 additions and 1062 deletions
@@ -105,8 +105,12 @@ public class MonsterControl_BossBase : MonsterContral
isLocalCoin = false;
killerSitPos = -1;
var res = FishResourcesData.fishResourcesDatasDic[fishTypeID];
if (res.showAudio != null && res.showAudio.Count > 0)
// ⭐ TryGetValue 判空:fishTypeID 未配置的 Boss(如 7005 预制体 fishTypeID=0)直接索引会抛
// KeyNotFoundException——OnEnable 是 Unity 生命周期回调,异常会中断整条 base 调用链,
// 子类(如 StealthBossControl)在 base.OnEnable() 之后的潜行初始化会全部跳过,潜行失效。
// 查不到时仅跳过出场音效,不影响其他逻辑
if (FishResourcesData.fishResourcesDatasDic.TryGetValue(fishTypeID, out var res)
&& res.showAudio != null && res.showAudio.Count > 0)
AudioManager.Instance.PlayerFX(res.showAudio[Random.Range(0, res.showAudio.Count)]);
}