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); }
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); }
public static T Create <T>() where T : BTNode, new() { return(BTFactory.CreateNode <T>()); }
static BTInfo CreateBtInfo() { var bt = LoadBehaviorTree(); return(BTFactory.CreateBtInfo(bt)); }