Files
JiboOs/docs/bt/Decorator.js

60 lines
2.1 KiB
JavaScript
Raw Normal View History

2026-03-16 13:53:01 +02:00
/**
* @class Decorator
* @memberof jibo.bt
* @description Baseclass for all decorators. Decorators can force a behavior to succeed or fail. They can restart
* a behavior once it's failed or succeeded, and they can modify when a behavior starts.
*
* Subclasses: {@link jibo.bt.decorators}
* @param {Object} [options] Options for the decorator
* @param {String} [options.name=''] Name of the decorator instance
* @param {jibo.bt.Blackboard} [options.blackboard=null] Blackobard instance
* @param {jibo.bt.BehaviorEmitter} [options.emitter=null] Emitter instance
* @param {String} [options.assetPack=''] Name of the asset pack
* @param {Object} [defaultOptions] Defaults for options
*/
/**
* The parent behavior
* @name jibo.bt.Decorator#behavior
* @type {Behavior}
* @readOnly
*/
/**
* Starts the behavior or decorator
* @method jibo.bt.Decorator#start
* @returns {Boolean|Status.WAIT} `true` if this element is started successfully. `false` otherwise. `Status.WAIT` will be returned if the decorated behavior should not start yet.
*/
/**
* Called every frame. Gives a chance for this decorator to change the status of a behavior.
* @method jibo.bt.Decorator#update
* @param result {jibo.bt.Status} The current status of the behavior this decorator is decorating.
* @returns {jibo.bt.Status} The modified status of the behavior this decorator is decorating.
*/
/**
* Destroy this
*/
/**
* Internal start from the behavior tree level
* @method jibo.bt.Decorator#_start
* @private
* @return {Boolean} Success
*/
/**
* Internal stop from the behavior tree level
* @method jibo.bt.Decorator#_stop
* @return {Promise<void>} A promise that resolves after any asynchronous cleanup has been performed.
* @private
*/
/**
* Internal update from the behavior tree level
* @method jibo.bt.Decorator#_update
* @private
* @param {jibo.bt.Status} result
* @return {jibo.bt.Status} resulting status
*/