mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "17f70f45-0535-4a62-ac99-ff01d443fdaa",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-22 21:47:14
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-25 10:39:17
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Parallel')
|
||||
export class Parallel extends bt.BehaviorParallel {
|
||||
//0 全部成功 -1 全部失败 XXX 指定数目
|
||||
@bt.property({
|
||||
type: bt.SharedNumber,
|
||||
tooltip: "0 全部成功 -1 全部失败 XXX 指定数目"
|
||||
})
|
||||
threshold: bt.SharedNumber = null;
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "9c55e127-014e-4c43-a3fc-ae365a33660e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-22 21:47:14
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:57:44
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Selector')
|
||||
export class Selector extends bt.BehaviorSelector {
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8a338f79-6dc4-47bf-b115-99939da4334a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-22 21:47:14
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:57:50
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Sequence')
|
||||
export class Sequence extends bt.BehaviorSequence {
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7c89509f-3b00-4280-a624-da0244751097",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "1c97c0ed-70d8-4f41-aac9-776314784e2a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d42d0a9e-6c20-4783-a3cc-d4b7c0a9a86c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.22",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "1d908018-799f-4291-bfab-54462fc6134f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 21:04:22
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.Conditional')
|
||||
@bt.delegate(['onUpdate'])
|
||||
export class Conditional extends bt.BehaviorConditional {
|
||||
execute(status: BehaviorStatus): BehaviorStatus {
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "4d9302f7-1678-42bf-bd67-adafb5046464",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 21:04:22
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.ConditionalFilter')
|
||||
@bt.delegate(['onUpdate'])
|
||||
export class ConditionalFilter extends bt.BehaviorConditional {
|
||||
@bt.property({
|
||||
type: bt.SharedBoolean,
|
||||
tooltip: "Filter by shared variable / 根据共享变量值进行条件过滤",
|
||||
})
|
||||
|
||||
filter: bt.SharedBoolean = null;
|
||||
|
||||
execute(status: BehaviorStatus): BehaviorStatus {
|
||||
if(this.filter){
|
||||
status = this.filter?.value ? BehaviorStatus.Success : BehaviorStatus.Failure;
|
||||
}
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "af7c4ac8-a8b8-462b-a5f0-1cafd267faf2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 21:04:22
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.ConditionalInverter')
|
||||
export class ConditionalInverter extends bt.BehaviorConditional {
|
||||
execute(status: BehaviorStatus): BehaviorStatus {
|
||||
if(status == BehaviorStatus.Success){
|
||||
status = BehaviorStatus.Failure;
|
||||
}
|
||||
else if(status == BehaviorStatus.Failure){
|
||||
status = BehaviorStatus.Success;
|
||||
}
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d859a850-5ba5-48c5-ab5f-699f7a7c3930",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:06
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.Decorator')
|
||||
@bt.delegate(['onUpdate'])
|
||||
export class Decorator extends bt.BehaviorDecorator {
|
||||
execute(status: bt.BehaviorStatus): bt.BehaviorStatus {
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "337cc1bc-1a26-4dbd-9463-d9ab87bf9f21",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:09
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.ForceFailure')
|
||||
export class ForceFailure extends bt.BehaviorDecorator {
|
||||
execute(status: bt.BehaviorStatus): BehaviorStatus {
|
||||
status = BehaviorStatus.Failure;
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "0c445730-1709-4524-8cb5-6c9b4faa371b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:13
|
||||
* @Description: 当监听的黑板键发生变化时强制中断
|
||||
*/
|
||||
|
||||
import { js } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.ForceInterrupter')
|
||||
export class ForceInterrupter extends bt.BehaviorDecorator {
|
||||
@bt.property({
|
||||
type: bt.ENotifyObserver,
|
||||
tooltip: "触发时机(比较结果改变时/黑板键的值改变时)",
|
||||
})
|
||||
notifyType = bt.ENotifyObserver.OnValueChange;
|
||||
|
||||
@bt.property({
|
||||
type: bt.EAbortType,
|
||||
tooltip: "中断类型(Self:中断自身分支;LowerPriority:中断低优先级的兄弟分支)"
|
||||
})
|
||||
abortType = bt.EAbortType.None;
|
||||
|
||||
@bt.property({
|
||||
type: bt.EQueryKey,
|
||||
tooltip: "比较方式"
|
||||
})
|
||||
keyQuery = bt.EQueryKey.IsEqualTo;
|
||||
|
||||
@bt.property({
|
||||
type: bt.SharedDynamic,
|
||||
tooltip: "用于与 {{target}} 对应黑板键的值进行比较",
|
||||
})
|
||||
targetValue = undefined as unknown as any;
|
||||
|
||||
@bt.property({
|
||||
type: bt.SharedVariable,
|
||||
tooltip: "指定黑板键"
|
||||
})
|
||||
target: bt.SharedVariable<any> = null;
|
||||
|
||||
private _isSet = false;
|
||||
private _isEqual = false;
|
||||
|
||||
load(): void {
|
||||
super.load();
|
||||
|
||||
this.$context.blackboard.on(bt.ENotifyObserver.OnValueChange, this.onValueChange, this);
|
||||
this._isSet = typeof this.target?.value != 'undefined' ? true : false;
|
||||
this._isEqual = this.target?.value == this.targetValue ? true : false;
|
||||
}
|
||||
destroy(): void {
|
||||
this.$context.blackboard.targetOff(this);
|
||||
this.reset();
|
||||
super.destroy();
|
||||
}
|
||||
reset(): void {
|
||||
this._isSet = false;
|
||||
this._isEqual = false;
|
||||
}
|
||||
protected onValueChange(shared: bt.SharedVariable<any>, oldValue: any){
|
||||
if(this.abortType === bt.EAbortType.None || !this.target){
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.target.name != shared.name){
|
||||
return;
|
||||
}
|
||||
|
||||
//值改变时触发
|
||||
if(this.notifyType==bt.ENotifyObserver.OnValueChange){
|
||||
if(this.target.value == oldValue){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//结果改变时触发
|
||||
else if(this.notifyType==bt.ENotifyObserver.OnResultChange){
|
||||
let isSet = typeof shared?.value != 'undefined' ? true : false;
|
||||
if(this.keyQuery==bt.EQueryKey.IsSet && isSet){
|
||||
if(this._isSet == isSet){
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(this.keyQuery==bt.EQueryKey.IsNotSet && !isSet){
|
||||
if(this._isSet == isSet){
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._isSet = isSet;
|
||||
|
||||
let isEqual = shared?.value == this.targetValue ? true : false;
|
||||
if(this.keyQuery==bt.EQueryKey.IsEqualTo && isEqual){
|
||||
if(this._isEqual == isEqual){
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(this.keyQuery==bt.EQueryKey.IsNotEqualTo && !isEqual){
|
||||
if(this._isEqual == isEqual){
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._isEqual = isEqual;
|
||||
}
|
||||
|
||||
if(this.abortType == bt.EAbortType.LowerPriority || this.abortType == bt.EAbortType.Both){
|
||||
this.parent.abort();
|
||||
}
|
||||
if(this.abortType == bt.EAbortType.Self || this.abortType == bt.EAbortType.Both){
|
||||
this.owner.abort();
|
||||
}
|
||||
}
|
||||
|
||||
execute(status: bt.BehaviorStatus): bt.BehaviorStatus {
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "84cc7c4d-cc7a-4dfb-a5cc-5ff7e0e0be71",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-26 12:11:26
|
||||
* @Description: 强制返回 Running
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.ForceRunning')
|
||||
export class ForceRunning extends bt.BehaviorDecorator {
|
||||
execute(status: bt.BehaviorStatus): BehaviorStatus {
|
||||
status = BehaviorStatus.Running;
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b7669b22-5129-483a-9ca2-473f66bac9f4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:19
|
||||
* @Description: 强制返回成功
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.ForceSuccessful')
|
||||
export class ForceSuccessful extends bt.BehaviorDecorator {
|
||||
execute(status: bt.BehaviorStatus): BehaviorStatus {
|
||||
status = BehaviorStatus.Success;
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "ef4ac11f-7e97-4ed4-8058-487b9fe06810",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-05-26 09:55:16
|
||||
* @Description: 当监听的条件节点状态发生改变时产生中断
|
||||
*/
|
||||
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Interrupter')
|
||||
export class Interrupter extends bt.BehaviorDecorator {
|
||||
isInterrupter = true;
|
||||
|
||||
@bt.property({
|
||||
type: bt.EAbortType,
|
||||
tooltip: "中断类型(Self:中断自身分支;LowerPriority:中断低优先级的兄弟分支)"
|
||||
})
|
||||
abortType = bt.EAbortType.None;
|
||||
|
||||
public getLogSymbol(){
|
||||
return "inte &!"
|
||||
}
|
||||
|
||||
load(): void {
|
||||
super.load();
|
||||
|
||||
if(this.abortType == bt.EAbortType.LowerPriority || this.abortType == bt.EAbortType.Both){
|
||||
this.parent.addInterrupter(this);
|
||||
}
|
||||
if(this.abortType == bt.EAbortType.Self || this.abortType == bt.EAbortType.Both){
|
||||
this.owner.addInterrupter(this);
|
||||
}
|
||||
}
|
||||
destroy(): void {
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
execute(status: bt.BehaviorStatus): bt.BehaviorStatus {
|
||||
return super.execute(status);
|
||||
}
|
||||
|
||||
executeInterrupt(parent: bt.BehaviorEntity, child: bt.BehaviorEntity){
|
||||
this.enter();
|
||||
this.enable();
|
||||
|
||||
let status = bt.BehaviorStatus.Failure;
|
||||
|
||||
if(this.owner == parent || this.owner == child){
|
||||
status = child.checkCondition(status);
|
||||
}
|
||||
|
||||
this.execute(status);
|
||||
|
||||
this.disable();
|
||||
this.exit();
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b7632320-68d1-48ee-9a37-fce4ad2875da",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:30
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.Inverter')
|
||||
export class Inverter extends bt.BehaviorDecorator {
|
||||
execute(status: bt.BehaviorStatus): BehaviorStatus {
|
||||
if(status == BehaviorStatus.Success){
|
||||
status = BehaviorStatus.Failure;
|
||||
}
|
||||
else if(status == BehaviorStatus.Failure){
|
||||
status = BehaviorStatus.Success;
|
||||
}
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "1c7ee336-e0e4-4db8-b8d3-fd6bf6ea8ac4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-25 10:55:50
|
||||
* @Description: 随机返回成功
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
import { BehaviorStatus } from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.RandomSuccessful')
|
||||
export class RandomSuccessful extends bt.BehaviorDecorator {
|
||||
@bt.property({
|
||||
tooltip: "返回成功的机率(0~1)"
|
||||
})
|
||||
percent: number = 0.5;
|
||||
|
||||
execute(status: bt.BehaviorStatus): BehaviorStatus {
|
||||
if(this.percent==0){
|
||||
status = BehaviorStatus.Failure;
|
||||
}
|
||||
else if(this.percent==1){
|
||||
status = BehaviorStatus.Success;
|
||||
}
|
||||
else{
|
||||
let percent = Math.random();
|
||||
if(percent<this.percent){
|
||||
status = BehaviorStatus.Success;
|
||||
}
|
||||
else{
|
||||
status = BehaviorStatus.Failure;
|
||||
}
|
||||
}
|
||||
return super.execute(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "e9db3b94-cf0a-4b62-90c5-f803da201f90",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:35
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
// const { Behavior } = Node;
|
||||
|
||||
@bt.ccclass('bt.Repeater')
|
||||
export class Repeater extends bt.BehaviorDecorator {
|
||||
@bt.property({
|
||||
tooltip: "Repeat times / 重复次数"
|
||||
})
|
||||
times: number = 0;
|
||||
|
||||
private current = 0;
|
||||
|
||||
reset(){
|
||||
super.reset();
|
||||
this.current = 0;
|
||||
}
|
||||
|
||||
execute(status: bt.BehaviorStatus): bt.BehaviorStatus {
|
||||
if(!this.checkValid(status)){
|
||||
//运行中的任务强行返回 Success
|
||||
if(status == bt.BehaviorStatus.Running){
|
||||
status = bt.BehaviorStatus.Success;
|
||||
}
|
||||
}
|
||||
else{
|
||||
status = bt.BehaviorStatus.Running;
|
||||
}
|
||||
|
||||
return super.execute(status);
|
||||
}
|
||||
|
||||
protected checkValid(status: bt.BehaviorStatus): boolean {
|
||||
//默认值为0,表示无限重复
|
||||
if(this.times == 0){
|
||||
return true;
|
||||
}
|
||||
|
||||
this.current++;
|
||||
if(this.times>this.current){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
getAppendedLog(stage: string, status?: bt.BehaviorStatus){
|
||||
if(stage=='execute'){
|
||||
return `[ Repeat times: ${this.current} / ${this.times} ]`;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "6ad35caa-f48f-4ad8-84bc-a5be1601f5a9",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-04-22 21:01:36
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 21:03:25
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
export * from "./composite/Parallel";
|
||||
export * from "./composite/Selector";
|
||||
export * from "./composite/Sequence";
|
||||
|
||||
export * from "./decorator/Conditional";
|
||||
export * from "./decorator/Decorator";
|
||||
export * from "./decorator/ForceFailure";
|
||||
export * from "./decorator/ForceInterrupter";
|
||||
export * from "./decorator/ForceSuccessful";
|
||||
export * from "./decorator/Interrupter";
|
||||
export * from "./decorator/Inverter";
|
||||
export * from "./decorator/Repeater";
|
||||
|
||||
export * from "./service/Service";
|
||||
|
||||
export * from "./task/Idle";
|
||||
export * from "./task/Log";
|
||||
export * from "./task/Task";
|
||||
export * from "./task/Wait";
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b439e563-eb58-4261-a9a6-61d16627de51",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "76e750b8-e50e-4a45-8223-ad29e4da21ff",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-08-26 09:54:48
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Service')
|
||||
@bt.delegate(['onUpdate'])
|
||||
export class Service extends bt.BehaviorService {
|
||||
// constructor(parameters) {
|
||||
// super(parameters);
|
||||
// }
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "c1106a2c-d6a5-4c52-9f17-9ae5f5d9dfb6",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "5b635fc2-6018-410a-b92a-ae181857a809",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:45
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Idle')
|
||||
export class Idle extends bt.BehaviorTask {
|
||||
update(status: bt.BehaviorStatus){
|
||||
status = bt.BehaviorStatus.Running;
|
||||
return this.onUpdate(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "1c46dbe8-1984-4cc0-8be9-1ea336a407d5",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-25 10:43:03
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Log')
|
||||
@bt.delegate(['onUpdate'])
|
||||
export class Log extends bt.BehaviorTask {
|
||||
@bt.property({
|
||||
type: bt.SharedString
|
||||
})
|
||||
message: bt.SharedString = null;
|
||||
|
||||
update(status: bt.BehaviorStatus){
|
||||
if(this.message){
|
||||
bt.logger.log(`[${this.nodeConfig.title}]-[${this.nodeConfig.order}] : message = [${this.message.value}]`);
|
||||
}
|
||||
status = bt.BehaviorStatus.Success;
|
||||
return this.onUpdate(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "11601f6d-3d94-447b-b18e-06e8bf1ae296",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-22 12:58:54
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import { Node } from "cc";
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Task')
|
||||
@bt.delegate(['onUpdate'])
|
||||
export class Task extends bt.BehaviorTask {
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "917dcfc1-e1b0-40ae-ad50-ac115a43a824",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* @Author: OreoWang
|
||||
* @Email: ihc523@163.com
|
||||
* @Date: 2022-03-21 21:52:56
|
||||
* @LastEditors: OreoWang
|
||||
* @LastEditTime: 2022-04-26 14:51:12
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
import * as bt from "../../core/main";
|
||||
|
||||
@bt.ccclass('bt.Wait')
|
||||
export class Wait extends bt.BehaviorTask {
|
||||
@bt.property({
|
||||
type: bt.SharedNumber
|
||||
})
|
||||
duration: bt.SharedNumber = null;
|
||||
|
||||
_intervel: number = 0;
|
||||
|
||||
update(status: bt.BehaviorStatus){
|
||||
status = bt.BehaviorStatus.Running;
|
||||
|
||||
if(this.duration.original>0){
|
||||
let duration = this.duration.value;
|
||||
this._intervel += this.$context.deltaTime;
|
||||
if(this._intervel - duration >= 0){
|
||||
status = bt.BehaviorStatus.Success;
|
||||
this._intervel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return this.onUpdate(status);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d6ba0702-3b88-46ca-bd37-9ce33d07956a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user