Files
JiboOs/docs/bt/Behavior.js

91 lines
2.4 KiB
JavaScript
Raw Normal View History

2026-03-16 13:53:01 +02:00
/**
* @class Behavior
* @memberof jibo.bt
* @description The baseclass to all behaviors.
*
* Subclasses: {@link jibo.bt.behaviors}
* @param {Object} [options] Options for the behavior
* @param {String} [options.name=''] Name of the behavior instance
* @param {Array<jibo.bt.Decorator>} [options.decorators=[]] Decorators
* @param {jibo.bt.Blackboard} [options.blackboard=null] Blackboard 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
*/
/**
* Reference to the composite parent behavior
* @name jibo.bt.Behavior#parent
* @type {jibo.bt.ParentBehavior}
* @readOnly
*/
/**
* List of decorators to wait on start
* @name jibo.bt.Behavior#waitDecorators
* @type {Array<jibo.bt.Decorator>}
* @private
*/
/**
* Number of wait decorators
* @name jibo.bt.Behavior#waitDecoratorsLength
* @type {int}
* @private
*/
/**
* Destroy this
*/
/**
* Collection of decorators
* @name jibo.bt.Behavior#decorators
* @type {Array<jibo.bt.Decorator>}
* @readOnly
*/
/**
* Starts the behavior or decorator
* @method jibo.bt.Behavior#start
* @returns {Boolean} `true` if this element is started successfully. `false` otherwise.
*/
/**
* Called every frame. Must be overridden in subclass.
* @method jibo.bt.Behavior#update
* @returns {jibo.bt.Status} The current status of this behavior.
*/
/**
* Internal pause the behavior
* @method jibo.bt.Behavior#_pause
* @private
*/
/**
* Internal unpause the behavior
* @method jibo.bt.Behavior#_unpause
* @private
*/
/**
* Internal start the behavior
* @method jibo.bt.Behavior#_start
* @private
* @return {Boolean} Status result
*/
/**
* Internal stop the behavior
* @method jibo.bt.Behavior#_stop
* @return {Promise<void>} A promise that resolves after any asynchronous cleanup has been performed.
* @private
*/
/**
* Internal update the behavior
* @method jibo.bt.Behavior#_update
* @private
* @return {jibo.bt.Status} Resulting status
*/