Esempio n. 1
0
        public ActionListNode <T> AddAction_Next(GameAction <T> action, ExecuteRule TransRule)
        {
            ActionListNode <T> a = new ActionListNode <T>();

            a._parent       = this;
            action.Executor = Executor;
            a.action        = action;
            if (List.Count == 0)
            {
                if (entered)
                {
                    action.Enter();
                }
                List.AddLast(a);
                rules.AddLast(TransRule);
                currentNode = List.First;
                currentRule = rules.First;
            }
            else
            {
                List.AddAfter(List.First, a);
                rules.AddAfter(rules.First, TransRule);
            }
            return(a);
        }
Esempio n. 2
0
        public BTActionNode(GameAction <T> action, ExecuteRule failRule, ExecuteRule succeedRule)
        {
            this.action = action;

            FailRule    = failRule;
            SucceedRule = succeedRule;
        }
Esempio n. 3
0
        public ActionListNode <T> AddAction_End(GameAction <T> action, ExecuteRule TransRule)
        {
            ActionListNode <T> a = new ActionListNode <T>();

            action.Executor = Executor;
            a._parent       = this;
            a.action        = action;
            List.AddLast(a);
            rules.AddLast(TransRule);
            if (currentNode == null)
            {
                if (entered)
                {
                    action.Enter();
                }
                currentNode = List.Last;
                currentRule = rules.Last;
            }

            return(a);
        }
Esempio n. 4
0
 public RuleEOR(ExecuteRule L, ExecuteRule R)
 {
     this.L = L;
     this.R = R;
 }
Esempio n. 5
0
 public RuleNOT(ExecuteRule R)
 {
     this.R = R;
 }
Esempio n. 6
0
 public RuleAnd(ExecuteRule L, ExecuteRule R)
 {
     this.L = L;
     this.R = R;
 }
Esempio n. 7
0
 public override void Enter()
 {
     curID = selecter.ExecuteSelecter();
     actionList[curID].Enter();
     curRule = actionTrans[curID];
 }
Esempio n. 8
0
 /// <summary>
 /// 增加一个决策行为
 /// </summary>
 /// <param name="action">行为</param>
 /// <param name="actionTrans">行为跳转的规则</param>
 public void addAction(GameAction <T> action, ExecuteRule actionTrans)
 {
     actionList.Add(action);
     this.actionTrans.Add(actionTrans);
 }
Esempio n. 9
0
 /// <summary>
 /// 增加一个决策行为
 /// </summary>
 /// <param name="action">行为</param>
 /// <param name="actionScoreCalc">行为决策函数</param>
 /// <param name="actionTrans">行为跳转的规则</param>
 public void addAction(GameAction <T> action, Utility actionScoreCalc, ExecuteRule actionTrans)
 {
     actionList.Add(action);
     actionScore.Add(actionScoreCalc);
     this.actionTrans.Add(actionTrans);
 }