public static ITickNode PrioritySelector(this ITickNode parent, params ITickNode[] nodes) { var tempnode = new BTPrioritySelector(parent); AddNodesToParent(tempnode, nodes); return(tempnode); }
public static ITickNode Action(this ITickNode parent, params ITickNode[] nodes) { var tempnode = new BTAction(parent); AddNodesToParent(tempnode, nodes); return(tempnode); }
public static ITickNode Sequence(this ITickNode parent, params ITickNode[] nodes) { var tempnode = new BTSequence(parent); AddNodesToParent(tempnode, nodes); return(tempnode); }
public static ITickNode Loop(this ITickNode Ticknode, int loopcount) { var tempnode = new Decorate.Loop(Ticknode, loopcount); ReplaceInParent(Ticknode, tempnode); return(tempnode); }
public static ITickNode Time_Delay(this ITickNode Ticknode, float delayTime) { var tempnode = new Decorate.Timer_DelayNode(Ticknode, delayTime); ReplaceInParent(Ticknode, tempnode); return(tempnode); }
public static void ReplaceInParent(ITickNode origin, ITickNode target) { if (origin.ParentNode != null) { var index = origin.ParentNode.ChildrenNotes.IndexOf(origin); origin.ParentNode.ChildrenNotes[index] = target; } }
public Loop(ITickNode node) : base(node) { this.isLimited = false; this.count = 0; this.number = 0; this.name = "Decorator_Loop"; }
public void AddChildNode(ITickNode node) { if (this.ChildrenNotes == null) { this.childrenNotes = new List <ITickNode>(); } this.ChildrenNotes.Add(node); node.ParentNode = this; }
public static void AddNodesToParent(ITickNode parent, ITickNode[] nodes) { if (nodes.Length > 0) { for (int i = 0; i < nodes.Length; i++) { parent.AddChildNode(nodes[i]); } } }
public void RemoveNode(ITickNode node) { if (this.ChildrenNotes == null) { return; } if (this.ChildrenNotes.Contains(node)) { this.ChildrenNotes.Remove(node); } }
public static ITickNode End(this ITickNode parent) { return(parent.RootNode); }
public BTNode(ITickNode parrent) : base() { this.ParentNode = parrent; parrent.AddChildNode(this); }
public BTAction(ITickNode parent, Action action) : this(parent) { this.Action = action; }
public BTCondition(ITickNode parent) : base(parent) { this.name = "Condition"; }
public BTSequence(ITickNode parent) : base(parent) { this.name = "Sequence"; }
public BTCondition(ITickNode parent, Func <bool> func) : this(parent) { this.CheckAction = func; }
public static ITickNode Action(this ITickNode parent, Action action) { return(new BTAction(parent, action)); }
public void RemoveNode(ITickNode node) { this.node.RemoveNode(node); }
public static ITickNode Condition(this ITickNode parent, Func <bool> condition) { return(new BTCondition(parent, condition)); }
public BTDecorator(ITickNode node) : this() { this.node = node; }
public BTAction(ITickNode parent) : base(parent) { this.name = "Action"; }
public ITickNode Decorator(ITickNode node) { return(this.node = node); }
public void AddChildNode(ITickNode node) { this.node.AddChildNode(node); }
public Timer_DelayNode(ITickNode node, float delayTime) : base(node) { this.name = "Decorator_Timer"; this.DelayTime = delayTime; }
public Loop(ITickNode node, int count) : this(node) { this.isLimited = true; this.count = count; }
public BTPrioritySelector(ITickNode parent) : base(parent) { this.name = "PrioritySelector"; }