You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
This package is really useful but I'm struggling to implement a cooldown Decorator. Could you advise me why this doesn't work:
First i register the task:
BehaviorTree.register(
"fire",
new Task({
run: function (enemyShip) {
enemyShip.fireMissile();
return SUCCESS;
},
})
);
Then i decorate it:
const decoratedTask = new CooldownDecorator({
node: "fire",
config: 5,
});
Then I use it in the tree:
const tree = new Selector({
nodes: [
new Sequence({
nodes: [
new Task({
run: function (enemyShip) {
return enemyShip.checkIsInMissileRange(environmentDetails)
? SUCCESS
: FAILURE;
},
}),
new Task({
run: function (enemyShip) {
enemyShip.haltToStop(environmentDetails, setTargetShipDetails);
return SUCCESS;
},
}),
decoratedTask,
],
}),
new Sequence({
nodes: [
new Task({
run: function (enemyShip) {
enemyShip.moveToTarget(environmentDetails, setTargetShipDetails);
return SUCCESS;
},
}),
],
}),
],
});
However the task 'fire' is still called for every step of the behaviour tree. Thanks in advance!
The text was updated successfully, but these errors were encountered:
Hi,
This package is really useful but I'm struggling to implement a cooldown Decorator. Could you advise me why this doesn't work:
First i register the task:
Then i decorate it:
Then I use it in the tree:
However the task 'fire' is still called for every step of the behaviour tree. Thanks in advance!
The text was updated successfully, but these errors were encountered: