fix(boss): 防玩家死亡致命一击重入 —— EnemyBulletManager._swap_and_pop 负数守卫 + BossManager 循环内失效键跳过
This commit is contained in:
@@ -50,6 +50,8 @@ func _physics_process(delta: float) -> void:
|
|||||||
if _active.is_empty():
|
if _active.is_empty():
|
||||||
return
|
return
|
||||||
for boss_id in _active.keys():
|
for boss_id in _active.keys():
|
||||||
|
if not _active.has(boss_id):
|
||||||
|
continue # 防重入:本帧内被 reset()/erase(如玩家死亡致命一击)→ 跳过已失效键
|
||||||
if not EnemyManager.has_entity(boss_id):
|
if not EnemyManager.has_entity(boss_id):
|
||||||
continue
|
continue
|
||||||
var st: Dictionary = _active[boss_id]
|
var st: Dictionary = _active[boss_id]
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ func _physics_process(delta: float) -> void:
|
|||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
func _swap_and_pop(idx: int) -> void:
|
func _swap_and_pop(idx: int) -> void:
|
||||||
|
if _active_count <= 0:
|
||||||
|
return # 防重入:玩家死亡致命一击触发 reset() 已清空池,勿再 -1
|
||||||
var last: int = _active_count - 1
|
var last: int = _active_count - 1
|
||||||
if idx != last:
|
if idx != last:
|
||||||
var b_i: int = idx * ENEMY_BULLET_STRIDE
|
var b_i: int = idx * ENEMY_BULLET_STRIDE
|
||||||
|
|||||||
Reference in New Issue
Block a user