UNPKG

blueshell

Version:

A Behavior Tree implementation in modern Javascript

29 lines (28 loc) 1.04 kB
import { ResultCode, BlueshellState, BaseNode } from '../../models'; import { Decorator } from '../Decorator'; /** * Given a state, event, and result code (from a child Node), return a result code. * 7/30/21 * @author Timothy Deignan */ export interface ResultAdapter<S, E> { (state: S, event: E, res: ResultCode): ResultCode; } /** * Given a ResultAdapter, adapts the result code from the child node. * 7/30/21 * @author Timothy Deignan */ export declare class ResultAdapt<S extends BlueshellState, E> extends Decorator<S, E> { private resultAdapter; constructor(desc: string, child: BaseNode<S, E>, resultAdapter: ResultAdapter<S, E>); /** * 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. */ protected decorateResult(res: ResultCode, state: S, event: E): ResultCode; get symbol(): string; }