2025-10-03 18:56:49 +08:00
|
|
|
import { _decorator, Component, JsonAsset, sp } from 'cc';
|
|
|
|
|
import { BT } from './Header';
|
2025-09-17 10:25:13 +08:00
|
|
|
const { ccclass, property, menu } = _decorator;
|
|
|
|
|
@ccclass("GameEntry")
|
|
|
|
|
@menu("kunpo/GameEntry")
|
|
|
|
|
export class GameEntry extends Component {
|
2025-10-03 18:56:49 +08:00
|
|
|
@property(sp.Skeleton)
|
|
|
|
|
private skeleton: sp.Skeleton = null;
|
2025-09-17 10:25:13 +08:00
|
|
|
|
2025-10-03 18:56:49 +08:00
|
|
|
@property(JsonAsset)
|
|
|
|
|
private btConfig: JsonAsset = null;
|
2025-09-17 10:25:13 +08:00
|
|
|
|
2025-10-03 18:56:49 +08:00
|
|
|
private _tree: BT.BehaviorTree<sp.Skeleton> = null;
|
2025-09-17 10:25:13 +08:00
|
|
|
start(): void {
|
2025-10-03 18:56:49 +08:00
|
|
|
console.log("btConfig", this.btConfig);
|
2025-10-17 11:37:53 +08:00
|
|
|
let btTree1: BT.INodeConfig[] = this.btConfig.json["actor2"]
|
2025-10-03 18:56:49 +08:00
|
|
|
this._tree = BT.createBehaviorTree(btTree1, this.skeleton);
|
2025-09-17 10:25:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected update(dt: number): void {
|
2025-10-03 18:56:49 +08:00
|
|
|
this._tree.tick(dt);
|
2025-09-17 10:25:13 +08:00
|
|
|
}
|
|
|
|
|
}
|