行为树处理

行为树有Sequence Fallback RetryUntilSuccessful ReactiveSequence等控制节点。

我还有如下动作节点: BreakCheck BreakHandle StartCutter Plan Escape ForceFinish ClosureCheck FinishCheck CalcNavigationTarget Navigation ArriveTargetCheck

我想实现的逻辑如下:

while (true) {
    if (BreakCheck) {
        BreakHandle;
        StartCutter;
    }
    if (!Plan) {
        if (Escape) {
            StartCutter;
        } else {
            return SUCCESS;
        }
    }
    if (ClosureCheck) {
        if (FinishCheck) {
            return SUCCESS;
        } else {
            for (int i = 0; i < 3; ++ i) {
                CalcNavigationTarget;
                if (Navigation) {
                    break;
                }
            }
            if (!ArriveTargetCheck) {
                return SUCCESS;
            }
        }
    }
    return RUNNING;
}