feat(enemy): EnemyAbilityBase 加 ResolveConfig<T> 类型化配置解析(不匹配显式报错) + EditMode 测试
This commit is contained in:
@@ -155,6 +155,15 @@ namespace BaseGames.Enemies.Abilities
|
||||
if (target == null || _enemy == null) return;
|
||||
_enemy.FaceTarget(target.position);
|
||||
}
|
||||
|
||||
/// <summary>把 _config 解析为期望的子类型;类型不符/为空时显式报错(不回退)。</summary>
|
||||
protected T ResolveConfig<T>() where T : EnemyAbilitySO
|
||||
{
|
||||
if (_config is T typed) return typed;
|
||||
Debug.LogError($"[{GetType().Name}] _config 需为 {typeof(T).Name}," +
|
||||
$"实际 = {(_config != null ? _config.GetType().Name : "null")}。请重建为正确的子类 SO。", this);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>WaitForSeconds 池(架构 §10 GC 优化)。能力协程统一通过此获取等待指令。</summary>
|
||||
|
||||
Reference in New Issue
Block a user