修复 GameStateBattle -> GameStateShop/LevelUp 时的敌人异常残留问题

用一个 _isStopped 布尔门替代 id 追踪:

- OnReset 开头置 _isStopped = true
- OnInit 置 _isStopped = false
- OnShowEntitySuccess:只要 _isStopped 为真且是 Enemy 组,立即 HideEntity
- SpawnEnemyAsync await 恢复后也补一道 _isStopped 检查(若 await 拿到了 enemy 且已停战,直接 hide 不注册)——双保险

为什么这样对:停战窗口(Shop/LevelUp)期间本就不该有任何敌人,所以"停战期间出生的敌人一律 hide"在语义上完全正确,且不受 await 同步抽空、id 复用、加载时序任何影响。
This commit is contained in:
2026-06-26 13:53:36 +08:00
parent c111170bb0
commit 4250e48e22
3 changed files with 43 additions and 8 deletions
+1 -1
View File
@@ -738,7 +738,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 11499388, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_EditorResourceMode
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11499388, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3}
propertyPath: m_JsonHelperTypeName