blueshell
Version:
A Behavior Tree implementation in modern Javascript
30 lines • 956 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResultAdapt = void 0;
const Decorator_1 = require("../Decorator");
/**
* Given a ResultAdapter, adapts the result code from the child node.
* 7/30/21
* @author Timothy Deignan
*/
class ResultAdapt extends Decorator_1.Decorator {
constructor(desc, child, resultAdapter) {
super('ResultAdapt-' + desc, child);
this.resultAdapter = resultAdapter;
}
/**
* Executes the resultAdapter with the given state, event, and child result.
* @override
* @param res The result code return from the child node.
* @param state The state when the event occured.
* @param event The event to handle.
*/
decorateResult(res, state, event) {
return this.resultAdapter(state, event, res);
}
get symbol() {
return '⊜→';
}
}
exports.ResultAdapt = ResultAdapt;
//# sourceMappingURL=ResultAdapt.js.map