Hi, I'm trying to implement a combined sequence (Composite) that always return success.
I frequently use this pattern and would like to combine it into 1 node.
Which is used like this (AlwaysReturnTrue is set to true, so that the sequence SHOULD always be success even if the child fails.
However doesn't seem to work. If random probability returns Failure, the sequence still returns failure (even though executionStatus is forced to be Success)
Is there something behind the implementation that I'm missing? Maybe the execution status is propagated before `OnChildExecute` is called? If so, is there a better way to implement this composite?
I frequently use this pattern and would like to combine it into 1 node.
C#:
public override void OnChildExecuted(TaskStatus childStatus)
{
// Increase the child index and update the execution status after a child has finished running.
currentChildIndex++;
executionStatus = childStatus;
if (AlwaysReturnTrue && childStatus == TaskStatus.Failure)
{
currentChildIndex = children.Count;
executionStatus = TaskStatus.Success;
}
}
Which is used like this (AlwaysReturnTrue is set to true, so that the sequence SHOULD always be success even if the child fails.
However doesn't seem to work. If random probability returns Failure, the sequence still returns failure (even though executionStatus is forced to be Success)
Is there something behind the implementation that I'm missing? Maybe the execution status is propagated before `OnChildExecute` is called? If so, is there a better way to implement this composite?