Пример #1
0
        public void BuildWihtoutAnySetup()
        {
            var builder = new FluentBehaviourTreeBuilder <int, int>();

            Assert.Throws <BehaviourTreeBuilderException>(() =>
            {
                builder.Build();
            });
        }
Пример #2
0
        public void AddNodeTwice()
        {
            var builder = new FluentBehaviourTreeBuilder <int, int>();

            var moqAction = new Mock <IBehaviourTreeNodeSequence <int, int> >();

            Assert.Throws <BehaviourTreeBuilderException>(() =>
            {
                builder.Select(root => { });
                builder.Sequence(root => { });
            });
        }
Пример #3
0
        public void Build()
        {
            var builder = new FluentBehaviourTreeBuilder <int, int>();

            var moqAction = new Mock <IBehaviourTreeNodeSequence <int, int> >();

            moqAction.Setup(f => f.Compile()).Returns((time, state) => BehaviourTreeState.Running);

            builder.Root(moqAction.Object, root => { });

            var action = builder.Build();

            var compiled = action.Compile();

            Assert.NotNull(action);
            Assert.Equal(BehaviourTreeState.Running, compiled(1, 1));
        }