更新文档

This commit is contained in:
gongxh
2025-09-22 15:14:18 +08:00
parent 50e29feeb8
commit 80a2438f6e
10 changed files with 803 additions and 75 deletions

View File

@@ -7,33 +7,6 @@
import { sp } from "cc";
import { BT } from "./Header";
@BT.ClassAction("BTTestNode", { name: "嵌套数据测试节点", group: "测试", desc: "测试节点" })
export class BTTestNode extends BT.LeafNode {
@BT.prop({
type: BT.ParamType.object,
properties: {
x: { type: BT.ParamType.int, min: 0 },
y: { type: BT.ParamType.int, min: 0 }
}
})
position: { x: number, y: number };
// 对象数组参数
@BT.prop({
type: BT.ParamType.array,
itemType: BT.ParamType.object,
itemProperties: {
name: { type: BT.ParamType.string },
value: { type: BT.ParamType.int }
}
})
configs: Array<{ name: string, value: number }>;
public tick(): BT.Status {
return BT.Status.SUCCESS;
}
}
@BT.ClassAction("BTAnimation", { name: "播放动画", group: "动画", desc: "通过动画名播放动画,播放完成后返回成功" })
export class BTAnimation extends BT.LeafNode {
@BT.prop({ type: BT.ParamType.string, description: "动画名" })
@@ -86,6 +59,52 @@ export class BTConditionRandom extends BT.Condition {
}
/************************ 下方是几个编辑器中测试用的节点,删除即可 *************************/
@BT.ClassAction("BTTestNode2", { name: "空行为节点", group: "测试", desc: "测试节点" })
export class BTTestNode2 extends BT.LeafNode {
public tick(): BT.Status {
return BT.Status.SUCCESS;
}
}
@BT.ClassAction("BTTestNode", { name: "嵌套数据测试节点", group: "测试", desc: "测试节点" })
export class BTTestNode extends BT.LeafNode {
@BT.prop({
type: BT.ParamType.object,
properties: {
x: { type: BT.ParamType.int, min: 0 },
y: { type: BT.ParamType.int, min: 0 }
}
})
position: { x: number, y: number };
// 对象数组参数
@BT.prop({
type: BT.ParamType.array,
itemType: BT.ParamType.object,
itemProperties: {
name: { type: BT.ParamType.string },
value: { type: BT.ParamType.int }
}
})
configs: Array<{ name: string, value: number }>;
public tick(): BT.Status {
return BT.Status.SUCCESS;
}
}
/** 条件节点 */
@BT.ClassCondition("BTConditionTest", { name: "测试条件节点", group: "基础条件节点", desc: "" })
export class BTConditionRandomTest extends BT.Condition {
public isEligible(): boolean {
return true;
}
}
/** 条件装饰节点 */
@BT.ClassDecorator("BTCondition", { name: "条件装饰节点", group: "基础装饰节点", desc: "随机0-1的值大于设置值返回成功否则返回失败" })
export class BTCondition extends BT.ConditionDecorator {