mirror of
https://github.com/gongxh0901/kunpocc-behaviortree.git
synced 2025-12-26 16:48:56 +00:00
demo逻辑调整
This commit is contained in:
@@ -1,20 +1,23 @@
|
||||
import { _decorator, Component, Node } from 'cc';
|
||||
import * as BT from "kunpocc-behaviortree";
|
||||
import { _decorator, Component, JsonAsset, sp } from 'cc';
|
||||
import { BT } from './Header';
|
||||
const { ccclass, property, menu } = _decorator;
|
||||
@ccclass("GameEntry")
|
||||
@menu("kunpo/GameEntry")
|
||||
export class GameEntry extends Component {
|
||||
@property(Node)
|
||||
private stage: Node = null;
|
||||
@property(sp.Skeleton)
|
||||
private skeleton: sp.Skeleton = null;
|
||||
|
||||
@property(Node)
|
||||
private touchNode: Node = null;
|
||||
@property(JsonAsset)
|
||||
private btConfig: JsonAsset = null;
|
||||
|
||||
private _tree: BT.BehaviorTree<sp.Skeleton> = null;
|
||||
start(): void {
|
||||
BT
|
||||
console.log("btConfig", this.btConfig);
|
||||
let btTree1: BT.INodeConfig[] = this.btConfig.json["bt-tree1"]
|
||||
this._tree = BT.createBehaviorTree(btTree1, this.skeleton);
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
|
||||
this._tree.tick(dt);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user