Where should changes to the agents steering behavior go?
export class FooState extends YUKA.State {
constructor() {}
enter(agent) {
// Should this go here?
agent.steering.behaviors[0].active = false
agent.steering.behvariors[1].active = true
}
execute(agent) {
// OR should this go here?
agent.steering.behaviors[0].active = false
agent.steering.behvariors[1].active = true
}
}
Such code is usually placed in enter(). enter() is executed only a single time a state becomes active and thus an ideal spot for setting up the game entity (e.g. with new steering behaviors).
In a given state, one that controls behavior:
Where should changes to the agents steering behavior go?