diff --git a/Assets/Scripts/EnemyAIController.cs b/Assets/Scripts/EnemyAIController.cs index 6cb5853..e16b811 100644 --- a/Assets/Scripts/EnemyAIController.cs +++ b/Assets/Scripts/EnemyAIController.cs @@ -671,6 +671,7 @@ namespace Northbound private void DecayAggro() { List keysToRemove = new List(); + List> updates = new List>(); foreach (var kvp in _aggroTable) { @@ -681,10 +682,16 @@ namespace Northbound } else { - _aggroTable[kvp.Key] = newAggro; + updates.Add(new KeyValuePair(kvp.Key, newAggro)); } } + // 순회 후 수정 적용 + foreach (var update in updates) + { + _aggroTable[update.Key] = update.Value; + } + // 어그로가 0 이하인 항목 제거 foreach (var key in keysToRemove) {