Пример #1
0
        static BTAction LoadBehaviorTree()
        {
            BTFactory.BeforeCreateNode();
            var bt = Create <BTActionPrioritizedSelector>();

            bt
            .AddChild(Create <BTActionSequence>()
                      .SetPrecondition((BTPreconditionNot)Create <BTPreconditionNot>()
                                       .AddChild(Create <CON_HasReachedTarget>()))
                      .AddChild(Create <NOD_TurnTo>())
                      .AddChild(Create <NOD_MoveTo>()))
            .AddChild(Create <BTActionSequence>()
                      .AddChild(Create <NOD_TurnTo>())
                      .AddChild(Create <NOD_Attack>()));
            return(bt);
        }
Пример #2
0
        static BTInfo LoadBehaviorTreeDemo()
        {
            var info = new BTInfo();

            info.Id          = 0;
            info.Description = "asdfasf";
            BTFactory.BeforeCreateNode();
            var bt = Create <BTActionPrioritizedSelector>();

            bt
            .AddChild(Create <BTActionSequence>()
                      .SetPrecondition((BTPreconditionNot)Create <BTPreconditionNot>()
                                       .AddChild(Create <CON_HasReachedTarget>()))
                      .AddChild(Create <NOD_TurnTo>())
                      .AddChild(Create <NOD_MoveTo>()))
            .AddChild(Create <BTActionSequence>()
                      .AddChild(Create <NOD_TurnTo>())
                      .AddChild(Create <NOD_Attack>()));
            info.RootNode = bt;
            info.Init();
            return(info);
        }
Пример #3
0
 public static T Create <T>() where T : BTNode, new()
 {
     return(BTFactory.CreateNode <T>());
 }
Пример #4
0
        static BTInfo CreateBtInfo()
        {
            var bt = LoadBehaviorTree();

            return(BTFactory.CreateBtInfo(bt));
        }