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); }
public BTActionNode(GameAction <T> action, ExecuteRule failRule, ExecuteRule succeedRule) { this.action = action; FailRule = failRule; SucceedRule = succeedRule; }
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); }
public RuleEOR(ExecuteRule L, ExecuteRule R) { this.L = L; this.R = R; }
public RuleNOT(ExecuteRule R) { this.R = R; }
public RuleAnd(ExecuteRule L, ExecuteRule R) { this.L = L; this.R = R; }
public override void Enter() { curID = selecter.ExecuteSelecter(); actionList[curID].Enter(); curRule = actionTrans[curID]; }
/// <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); }
/// <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); }