import BehaviorTreeStatus from "../BehaviorTreeStatus" ; import BehaviorTreeError from "../Error/BehaviorTreeError" ; import Errors from "../Error/Errors" ; import StateData from "../StateData" ; import BehaviorTreeNodeInterface from "./BehaviorTreeNodeInterface" ; property property export default class ActionNode implements BehaviorTreeNodeInterface { public constructor ( public readonly name , public readonly fn ) { } public async tick ( state ) { const result = await this . fn ( state ) ; if ( ! result ) { throw new BehaviorTreeError ( Errors . NO_RETURN_VALUE ) ; } return result ; } }