fix: 修复黑板数据清理不彻底bug

This commit is contained in:
gongxh
2025-09-05 16:22:12 +08:00
parent 2ab47b2a7b
commit 10ca8fd2a8
5 changed files with 592 additions and 6 deletions

View File

@@ -6,7 +6,7 @@
* 专门用于存储和管理行为树执行过程中的共享数据
*/
import { IBTNode } from "../kunpocc-behaviortree";
import { IBTNode } from "./BTNode/BTNode";
/**
* 黑板数据接口
@@ -81,9 +81,14 @@ export class Blackboard implements IBlackboard {
public clean(): void {
// 清空当前黑板数据
this._data.clear();
// 重置运行状态
this.openNodes = new WeakMap<IBTNode, boolean>();
// 递归清理所有子黑板
for (const child of this.children) {
child.clean();
}
}
}