Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-05-26 13:04:38 +08:00
parent f74d7f1877
commit 5a0f1548ea
53 changed files with 4853 additions and 163 deletions

View File

@@ -616,6 +616,17 @@ namespace BaseGames.Enemies
private float _btCurrentInterval;
#endif
/// <summary>
/// 停止行为树(子类 Die() 预演出阶段可调用,防止 BT 继续 Tick 覆盖演出逻辑)。
/// 内部使用 #if GRAPH_DESIGNER 保护,子类无需处理条件编译。
/// </summary>
protected void StopBehaviorTree()
{
#if GRAPH_DESIGNER
_behaviorTree?.StopBehavior();
#endif
}
protected virtual void Die()
{
if (_currentState == EnemyStateType.Dead) return;
@@ -702,7 +713,7 @@ namespace BaseGames.Enemies
protected virtual void OnValidate()
{
if (_statsSO == null)
Debug.LogError($"[EnemyBase] {gameObject.name} 缺少 EnemyStatsSO 配置运行时会 NullRef。", this);
Debug.LogWarning($"[EnemyBase] {gameObject.name} 缺少 EnemyStatsSO 配置运行时会 NullRef。", this);
if (_stats == null)
Debug.LogWarning($"[EnemyBase] {gameObject.name} 未绑定 EnemyStats 组件引用。", this);
if (_animancer == null)