Package org.terasology.logic.behavior.tree

Examples of org.terasology.logic.behavior.tree.Node


        interpreter.tick(0);
        verify(task).onTerminate(Status.SUCCESS);
    }

    private void create() {
        node = new Node() {
            @Override
            public Task createTask() {
                task = spy(new Task(null) {
                    @Override
                    public Status update(float dt) {
View Full Code Here


public class SelectorTest {
    @Test
    public void testTwoChildrenSucceeds() {
        final Task[] spies = new Task[2];
        Interpreter interpreter = new Interpreter(null);
        Node one = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                when(spy.update(anyInt())).thenReturn(Status.RUNNING, Status.SUCCESS);
                spies[0] = spy;
            }
        });
        Node two = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                spies[1] = spy;
            }
        });
View Full Code Here

    @Test
    public void testTwoContinues() {
        final Task[] spies = new Task[2];
        Interpreter interpreter = new Interpreter(null);
        Node one = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                when(spy.update(anyInt())).thenReturn(Status.RUNNING, Status.FAILURE);
                spies[0] = spy;
            }
        });
        Node two = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                when(spy.update(anyInt())).thenReturn(Status.RUNNING);
                spies[1] = spy;
            }
View Full Code Here

    public void testOnePassThrough() {
        final Task[] spies = new Task[1];
        Status[] stats = new Status[]{Status.SUCCESS, Status.FAILURE};
        for (final Status status : stats) {
            Interpreter interpreter = new Interpreter(null);
            Node mock = create(new Mocker() {
                @Override
                public void mock(Task spy) {
                    when(spy.update(0)).thenReturn(Status.RUNNING, status);
                    spies[0] = spy;
                }
View Full Code Here

            verify(spies[0]).onTerminate(status);
        }
    }

    private Node create(final Mocker mocker) {
        final Node node = new DebugNode(1);
        return new Node() {
            @Override
            public Task createTask() {
                Task spy = spy(new Task(null) {
                    @Override
                    public Status update(float dt) {
View Full Code Here

public class SequenceTest {
    @Test
    public void testTwoChildrenFails() {
        final Task[] spies = new Task[2];
        Interpreter interpreter = new Interpreter(null);
        Node one = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                when(spy.update(anyInt())).thenReturn(Status.RUNNING, Status.FAILURE);
                spies[0] = spy;
            }
        });
        Node two = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                spies[1] = spy;
            }
        });
View Full Code Here

    @Test
    public void testTwoChildrenContinues() {
        final Task[] spies = new Task[2];
        Interpreter interpreter = new Interpreter(null);
        Node one = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                when(spy.update(anyInt())).thenReturn(Status.RUNNING, Status.SUCCESS);
                spies[0] = spy;
            }
        });
        Node two = create(new Mocker() {
            @Override
            public void mock(Task spy) {
                when(spy.update(anyInt())).thenReturn(Status.RUNNING);
                spies[1] = spy;
            }
View Full Code Here

    public void testOneChildPassThrough() {
        final Task[] spies = new Task[1];
        Status[] stats = new Status[]{Status.SUCCESS, Status.FAILURE};
        for (final Status status : stats) {
            Interpreter interpreter = new Interpreter(null);
            Node mock = create(new Mocker() {
                @Override
                public void mock(Task spy) {
                    when(spy.update(0)).thenReturn(Status.RUNNING, status);
                    spies[0] = spy;
                }
View Full Code Here

            verify(spies[0]).onTerminate(status);
        }
    }

    private Node create(final Mocker mocker) {
        final Node node = new DebugNode(1);
        return new Node() {
            @Override
            public Task createTask() {
                Task spy = spy(new Task(null) {
                    @Override
                    public Status update(float dt) {
View Full Code Here

TOP

Related Classes of org.terasology.logic.behavior.tree.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.