Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selector node fails to return running #2

Open
FlounderBox opened this issue Mar 5, 2021 · 1 comment
Open

Selector node fails to return running #2

FlounderBox opened this issue Mar 5, 2021 · 1 comment

Comments

@FlounderBox
Copy link

When ticked, the following tree returns Success, when I would expect it to return Running. Is this intended?
image

@FlounderBox
Copy link
Author

This is the monobehaviour I tested with. Attach to any Unity game object, and enter playmode for the result to be printed in the console.

public class AivoRunningTest : MonoBehaviour
{
    TreeNode<float> behaviorTree;
    private void Awake()
    {
        behaviorTree = Tree();
    }

    private void Update()
    {
        Debug.Log(behaviorTree.Tick((long)Time.deltaTime, 0f));
    }

    public ActionNode<float> ReturnsRunning = new ActionNode<float>((timeTick, ctx) =>
    {
        return AivoTreeStatus.Running;
    });

    public ActionNode<float> ReturnsSuccess = new ActionNode<float>((timeTick, ctx) =>
    {
        return AivoTreeStatus.Success;
    });

    public TreeNode<float> Tree()
    {
        return new SelectorNode<float>
            (
                ReturnsRunning,
                ReturnsSuccess
            );
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant