mirror of
https://gitee.com/sli97/behavior-eden-coco-plugin.git
synced 2025-10-09 16:46:13 +00:00
init
This commit is contained in:
25
dist/runtime/core/biz/Action/Log.js
vendored
Normal file
25
dist/runtime/core/biz/Action/Log.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Log = void 0;
|
||||
const index_1 = require("../../index");
|
||||
let Log = class Log extends index_1.Action {
|
||||
constructor(text = "log") {
|
||||
super();
|
||||
this.text = "log";
|
||||
this.text = text;
|
||||
}
|
||||
onUpdate() {
|
||||
console.log(this.text);
|
||||
return index_1.NodeStatus.Success;
|
||||
}
|
||||
};
|
||||
Log = __decorate([
|
||||
(0, index_1.btclass)("Log")
|
||||
], Log);
|
||||
exports.Log = Log;
|
34
dist/runtime/core/biz/Action/Wait.js
vendored
Normal file
34
dist/runtime/core/biz/Action/Wait.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Wait = void 0;
|
||||
const index_1 = require("../../index");
|
||||
let Wait = class Wait extends index_1.Action {
|
||||
constructor(duration = 4000) {
|
||||
super();
|
||||
this.startTime = 0;
|
||||
this.duration = 2000;
|
||||
this.duration = duration;
|
||||
}
|
||||
onUpdate() {
|
||||
return index_1.NodeStatus.Success;
|
||||
return index_1.NodeStatus.Running;
|
||||
}
|
||||
onStart() {
|
||||
super.onStart();
|
||||
console.log("Wait onStart");
|
||||
}
|
||||
onEnd() {
|
||||
super.onEnd();
|
||||
console.log("Wait onEnd");
|
||||
}
|
||||
};
|
||||
Wait = __decorate([
|
||||
(0, index_1.btclass)("Wait")
|
||||
], Wait);
|
||||
exports.Wait = Wait;
|
18
dist/runtime/core/biz/Action/index.js
vendored
Normal file
18
dist/runtime/core/biz/Action/index.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./Log"), exports);
|
||||
__exportStar(require("./Wait"), exports);
|
59
dist/runtime/core/biz/Composite/Parallel.js
vendored
Normal file
59
dist/runtime/core/biz/Composite/Parallel.js
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_1 = require("../../index");
|
||||
let Parallel = class Parallel extends index_1.Composite {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.executionStatus = [];
|
||||
}
|
||||
get status() {
|
||||
let childrenComplete = true;
|
||||
for (let i = 0; i < this.executionStatus.length; i++) {
|
||||
if (this.executionStatus[i] == index_1.NodeStatus.Running) {
|
||||
childrenComplete = false;
|
||||
}
|
||||
else if (this.executionStatus[i] == index_1.NodeStatus.Failure) {
|
||||
return index_1.NodeStatus.Failure;
|
||||
}
|
||||
}
|
||||
return childrenComplete ? index_1.NodeStatus.Success : index_1.NodeStatus.Running;
|
||||
}
|
||||
set status(_) { }
|
||||
onConditionalAbort(childIndex) {
|
||||
this.index = 0;
|
||||
for (let i = 0; i < this.executionStatus.length; i++) {
|
||||
this.executionStatus[i] = index_1.NodeStatus.Inactive;
|
||||
}
|
||||
}
|
||||
onStart() {
|
||||
super.onStart();
|
||||
this.executionStatus = new Array(this.children.length);
|
||||
this.index = 0;
|
||||
for (let i = 0; i < this.executionStatus.length; i++) {
|
||||
this.executionStatus[i] = index_1.NodeStatus.Inactive;
|
||||
}
|
||||
}
|
||||
canRunParallelChildren() {
|
||||
return true;
|
||||
}
|
||||
onChildStarted() {
|
||||
this.executionStatus[this.index] = index_1.NodeStatus.Running;
|
||||
this.index++;
|
||||
}
|
||||
canExecute() {
|
||||
return this.index < this.children.length;
|
||||
}
|
||||
onChildExecuted(status, index) {
|
||||
this.executionStatus[index] = status;
|
||||
}
|
||||
};
|
||||
Parallel = __decorate([
|
||||
(0, index_1.btclass)("Parallel")
|
||||
], Parallel);
|
||||
exports.default = Parallel;
|
84
dist/runtime/core/biz/Composite/RandomSequence.js
vendored
Normal file
84
dist/runtime/core/biz/Composite/RandomSequence.js
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_1 = require("../../index");
|
||||
let RandomSequence = class RandomSequence extends index_1.Composite {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.executionOrder = [];
|
||||
}
|
||||
get index() {
|
||||
return this.executionOrder[this.executionOrder.length - 1];
|
||||
}
|
||||
onStart() {
|
||||
super.onStart();
|
||||
this.shuffle();
|
||||
}
|
||||
canExecute() {
|
||||
return Boolean(this.executionOrder.length) && this.status !== index_1.NodeStatus.Failure;
|
||||
}
|
||||
onChildExecuted(status, _) {
|
||||
switch (status) {
|
||||
case index_1.NodeStatus.Success:
|
||||
this.executionOrder.pop();
|
||||
if (this.executionOrder.length <= 0) {
|
||||
this.status = index_1.NodeStatus.Success;
|
||||
}
|
||||
else {
|
||||
this.status = index_1.NodeStatus.Running;
|
||||
}
|
||||
break;
|
||||
case index_1.NodeStatus.Failure:
|
||||
this.status = index_1.NodeStatus.Failure;
|
||||
break;
|
||||
case index_1.NodeStatus.Running:
|
||||
this.status = index_1.NodeStatus.Running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
onConditionalAbort() { }
|
||||
// onUpdate(): NodeStatus {
|
||||
// if (this.status === NodeStatus.Failure) {
|
||||
// return NodeStatus.Failure
|
||||
// }
|
||||
//
|
||||
// if (!this.executionOrder.length) {
|
||||
// this.status = NodeStatus.Success
|
||||
// return NodeStatus.Success
|
||||
// }
|
||||
//
|
||||
// const node = this.children[this.index]
|
||||
//
|
||||
// const res = node.run()
|
||||
//
|
||||
// if (res === NodeStatus.Failure) {
|
||||
// this.status = NodeStatus.Failure
|
||||
// return NodeStatus.Failure
|
||||
// }
|
||||
//
|
||||
// if (res === NodeStatus.Success) {
|
||||
// this.executionOrder.pop()
|
||||
// }
|
||||
//
|
||||
// return NodeStatus.Running
|
||||
// }
|
||||
shuffle() {
|
||||
this.executionOrder = [];
|
||||
const indexList = Array.from({ length: this.children.length }, (e, i) => i);
|
||||
for (let i = indexList.length - 1; i >= 0; i--) {
|
||||
const num = Math.floor(Math.random() * indexList.length);
|
||||
this.executionOrder.push(indexList.splice(num, 1)[0]);
|
||||
}
|
||||
}
|
||||
};
|
||||
RandomSequence = __decorate([
|
||||
(0, index_1.btclass)("RandomSequence")
|
||||
], RandomSequence);
|
||||
exports.default = RandomSequence;
|
47
dist/runtime/core/biz/Composite/Selector.js
vendored
Normal file
47
dist/runtime/core/biz/Composite/Selector.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_1 = require("../../index");
|
||||
let Selector = class Selector extends index_1.Composite {
|
||||
onStart() {
|
||||
super.onStart();
|
||||
this.index = 0;
|
||||
}
|
||||
canExecute() {
|
||||
return this.index < this.children.length && this.status !== index_1.NodeStatus.Success;
|
||||
}
|
||||
onChildExecuted(status, _) {
|
||||
switch (status) {
|
||||
case index_1.NodeStatus.Success:
|
||||
this.status = index_1.NodeStatus.Success;
|
||||
break;
|
||||
case index_1.NodeStatus.Failure:
|
||||
this.index++;
|
||||
if (this.index >= this.children.length) {
|
||||
this.status = index_1.NodeStatus.Failure;
|
||||
}
|
||||
else {
|
||||
this.status = index_1.NodeStatus.Running;
|
||||
}
|
||||
break;
|
||||
case index_1.NodeStatus.Running:
|
||||
this.status = index_1.NodeStatus.Running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
onConditionalAbort(index) {
|
||||
this.index = index;
|
||||
this.status = index_1.NodeStatus.Inactive;
|
||||
}
|
||||
};
|
||||
Selector = __decorate([
|
||||
(0, index_1.btclass)("Selector")
|
||||
], Selector);
|
||||
exports.default = Selector;
|
47
dist/runtime/core/biz/Composite/Sequence.js
vendored
Normal file
47
dist/runtime/core/biz/Composite/Sequence.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_1 = require("../../index");
|
||||
let Sequence = class Sequence extends index_1.Composite {
|
||||
onStart() {
|
||||
super.onStart();
|
||||
this.index = 0;
|
||||
}
|
||||
canExecute() {
|
||||
return this.index < this.children.length && this.status !== index_1.NodeStatus.Failure;
|
||||
}
|
||||
onChildExecuted(status, _) {
|
||||
switch (status) {
|
||||
case index_1.NodeStatus.Success:
|
||||
this.index++;
|
||||
if (this.index >= this.children.length) {
|
||||
this.status = index_1.NodeStatus.Success;
|
||||
}
|
||||
else {
|
||||
this.status = index_1.NodeStatus.Running;
|
||||
}
|
||||
break;
|
||||
case index_1.NodeStatus.Failure:
|
||||
this.status = index_1.NodeStatus.Failure;
|
||||
break;
|
||||
case index_1.NodeStatus.Running:
|
||||
this.status = index_1.NodeStatus.Running;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
onConditionalAbort(index) {
|
||||
this.index = index;
|
||||
this.status = index_1.NodeStatus.Inactive;
|
||||
}
|
||||
};
|
||||
Sequence = __decorate([
|
||||
(0, index_1.btclass)("Sequence")
|
||||
], Sequence);
|
||||
exports.default = Sequence;
|
20
dist/runtime/core/biz/Composite/index.js
vendored
Normal file
20
dist/runtime/core/biz/Composite/index.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./Sequence"), exports);
|
||||
__exportStar(require("./Selector"), exports);
|
||||
__exportStar(require("./Parallel"), exports);
|
||||
__exportStar(require("./RandomSequence"), exports);
|
22
dist/runtime/core/biz/Condition/ConditionHP.js
vendored
Normal file
22
dist/runtime/core/biz/Condition/ConditionHP.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const index_1 = require("../../index");
|
||||
let ConditionHP = class ConditionHP extends index_1.Condition {
|
||||
onUpdate() {
|
||||
// console.log("Blackboard.Instance.hp", Blackboard.Instance.hp, ",ConditionHP", Blackboard.Instance.hp >= 100);
|
||||
// if (Blackboard.Instance.hp >= 100) {
|
||||
// return NodeStatus.Success;
|
||||
// }
|
||||
return index_1.NodeStatus.Success;
|
||||
}
|
||||
};
|
||||
ConditionHP = __decorate([
|
||||
(0, index_1.btclass)("ConditionHP")
|
||||
], ConditionHP);
|
||||
exports.default = ConditionHP;
|
17
dist/runtime/core/biz/Condition/index.js
vendored
Normal file
17
dist/runtime/core/biz/Condition/index.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./ConditionHP"), exports);
|
32
dist/runtime/core/biz/Decorator/Inverter.js
vendored
Normal file
32
dist/runtime/core/biz/Decorator/Inverter.js
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Inverter = void 0;
|
||||
const index_1 = require("../../index");
|
||||
let Inverter = class Inverter extends index_1.Decorator {
|
||||
canExecute() {
|
||||
return this.status === index_1.NodeStatus.Inactive || this.status === index_1.NodeStatus.Running;
|
||||
}
|
||||
onChildExecuted(_, status) {
|
||||
this.status = status;
|
||||
}
|
||||
decorate(status) {
|
||||
switch (status) {
|
||||
case index_1.NodeStatus.Success:
|
||||
return index_1.NodeStatus.Failure;
|
||||
case index_1.NodeStatus.Failure:
|
||||
return index_1.NodeStatus.Success;
|
||||
default:
|
||||
return status;
|
||||
}
|
||||
}
|
||||
};
|
||||
Inverter = __decorate([
|
||||
(0, index_1.btclass)("Inverter")
|
||||
], Inverter);
|
||||
exports.Inverter = Inverter;
|
36
dist/runtime/core/biz/Decorator/Repeater.js
vendored
Normal file
36
dist/runtime/core/biz/Decorator/Repeater.js
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Repeater = void 0;
|
||||
const index_1 = require("../../index");
|
||||
let Repeater = class Repeater extends index_1.Decorator {
|
||||
constructor(children, repeatCount = Infinity, endOnFailure = false) {
|
||||
super(children);
|
||||
this.repeatCount = Infinity;
|
||||
this.curCount = 0;
|
||||
this.endOnFailure = false;
|
||||
this.repeatCount = repeatCount;
|
||||
this.endOnFailure = endOnFailure;
|
||||
}
|
||||
canExecute() {
|
||||
return (this.curCount < this.repeatCount &&
|
||||
(!this.endOnFailure || (this.endOnFailure && this.status !== index_1.NodeStatus.Failure)));
|
||||
}
|
||||
onChildExecuted(status) {
|
||||
this.curCount++;
|
||||
this.status = status;
|
||||
}
|
||||
onStart() {
|
||||
super.onStart();
|
||||
this.curCount = 0;
|
||||
}
|
||||
};
|
||||
Repeater = __decorate([
|
||||
(0, index_1.btclass)("Repeater")
|
||||
], Repeater);
|
||||
exports.Repeater = Repeater;
|
30
dist/runtime/core/biz/Decorator/UntilSuccess.js
vendored
Normal file
30
dist/runtime/core/biz/Decorator/UntilSuccess.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UntilSuccess = void 0;
|
||||
const index_1 = require("../../index");
|
||||
let UntilSuccess = class UntilSuccess extends index_1.Decorator {
|
||||
canExecute() {
|
||||
return this.status == index_1.NodeStatus.Inactive || this.status == index_1.NodeStatus.Failure;
|
||||
}
|
||||
onChildExecuted(status) {
|
||||
this.status = this.decorate(status);
|
||||
}
|
||||
onUpdate() {
|
||||
// let status: NodeStatus = (this.children[0] as Action | BTCondition).run();
|
||||
// if (status === NodeStatus.Failure) {
|
||||
// status = NodeStatus.Running;
|
||||
// }
|
||||
// return this.decorate(status);
|
||||
return index_1.NodeStatus.Success;
|
||||
}
|
||||
};
|
||||
UntilSuccess = __decorate([
|
||||
(0, index_1.btclass)("UntilSuccess")
|
||||
], UntilSuccess);
|
||||
exports.UntilSuccess = UntilSuccess;
|
19
dist/runtime/core/biz/Decorator/index.js
vendored
Normal file
19
dist/runtime/core/biz/Decorator/index.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./Inverter"), exports);
|
||||
__exportStar(require("./Repeater"), exports);
|
||||
__exportStar(require("./UntilSuccess"), exports);
|
20
dist/runtime/core/biz/index.js
vendored
Normal file
20
dist/runtime/core/biz/index.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./action"), exports);
|
||||
__exportStar(require("./composite"), exports);
|
||||
__exportStar(require("./decorator"), exports);
|
||||
__exportStar(require("./condition"), exports);
|
Reference in New Issue
Block a user