protected override Func <TTick, TState, BehaviourTreeState> CompileInternal() { var decoratedCompiledNode = DecoratedNode.Compile(); return((tick, state) => { decoratedCompiledNode(tick, state); return BehaviourTreeState.Success; }); }
protected override Func <TTick, TState, BehaviourTreeState> CompileInternal() { var compiled = DecoratedNode.Compile(); return((tick, state) => { var nodeState = compiled(tick, state); if (nodeState == BehaviourTreeState.Success) { return BehaviourTreeState.Failure; } if (nodeState == BehaviourTreeState.Failure) { return BehaviourTreeState.Success; } return nodeState; }); }
/// <inheritdoc /> protected override GladBehaviorTreeNodeState OnEvaluate(TContextType context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } GladBehaviorTreeNodeState state = DecoratedNode.Evaluate(context); if (state == GladBehaviorTreeNodeState.Failure) { return(GladBehaviorTreeNodeState.Success); } else if (state == GladBehaviorTreeNodeState.Success) { return(GladBehaviorTreeNodeState.Failure); } return(state); }
/// <inheritdoc /> public override void Reset() { //Just dispatch it to the decorated node. DecoratedNode.Reset(); }