UNPKG

blueshell

Version:

A Behavior Tree implementation in modern Javascript

30 lines (29 loc) 1.16 kB
/** * Created by masdoorian on 06/23/21 */ import { IfElse } from './IfElse'; import { BlueshellState, ResultCode, BaseNode, Conditional } from '../models'; /** * Latched If-Else Latched Composite Node. * * The conditional function is not called if the previous result was RUNNING - instead * the saved result of calling the conditional is used until the consequent/alternative * returns not RUNNING again and the state is reset * * If `conditional(state: S, event: E)` returns true, * control is passed to the consequent node. * * If `conditional(state: S, event: E)` returns false, * control is passed to the alternative node, or * if alternative is a result code, that is returned, or * if one is not provided, 'FAILURE' is returned. * * 06/23/21 * @author Mark Asdoorian */ export declare class LatchedIfElse<S extends BlueshellState, E> extends IfElse<S, E> { private conditionalToLatch; constructor(name: string, conditionalToLatch: Conditional<S, E>, consequent: BaseNode<S, E>, alternative?: BaseNode<S, E> | ResultCode); get latched(): boolean; protected _afterEvent(res: ResultCode, state: S, event: E): ResultCode; }