Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user