예제 #1
0
 /// <summary>
 /// Add a new child to the Selector, creating a PriorityNode.
 /// </summary>
 /// <param name='child'>Child.</param>
 /// <param name="prio">The assigned priority</param>
 /// <returns>A reference to the PriorityNode.</returns>
 public void AddChild(Node child, double prio = 1.0)
 {
     if (prio <= 0)
         throw new ArgumentException("prio must be positive: " + prio);
     PriorityNode pn = new PriorityNode(child,prio);
     children_.Add(pn);
     prioTotal += pn.Prio;
 }
예제 #2
0
 /// <summary>
 /// Construct a priority node with the given prio.
 /// </summary>
 /// <param name='n'>
 /// N.
 /// </param>
 /// <param name='prio'>
 /// Prio.
 /// </param>
 public PriorityNode(Node n, double prio)
 {
     node = n; priority = prio;
 }
예제 #3
0
 /// <summary>
 /// Construct a priority node with prio 1.
 /// </summary>
 /// <param name='n'>
 /// N.
 /// </param>
 public PriorityNode(Node n)
 {
     node = n; priority = 1;
 }
예제 #4
0
 /// <summary>Removes the specified child.</summary>
 /// <param name='child'>Node to remove.</param>
 /// <returns>The removed child Node.</returns>
 public Node RemoveChild(Node child)
 {
     PriorityNode n = children_.First(x => x.Child == child);
     children_.Remove(n);
     return n.Child;
 }
예제 #5
0
 /// <summary>
 /// Add a new child to the Selector, creating a PriorityNode.
 /// Take care to always save the return value as that is the only way to change its priority!
 /// </summary>
 /// <param name='child'>Child.</param>
 /// <param name="prio">The assigned priority</param>
 /// <returns>A reference to the PriorityNode.</returns>
 public PriorityNode AddChild(Node child, double prio = 1.0)
 {
     PriorityNode pn = new PriorityNode(child,prio);
     children_.Add(pn);
     return pn;
 }
예제 #6
0
 /// <summary>
 /// Construct a ConditionDecorator with the given Child and condition.
 /// </summary>
 /// <param name='child'>
 /// Child.
 /// </param>
 /// <param name='condition'>
 /// Condition on which to execute Child.
 /// </param>
 public ConditionDecorator(Node child, Func<bool> condition)
     : base(child)
 {
     this.condition = condition;
 }
예제 #7
0
 public void SetChild(Node n)
 {
     child_ = n;
 }
예제 #8
0
 /// <summary>
 /// Construct a Decorator with the given child Node.
 /// </summary>
 /// <param name='child'>
 /// Child.
 /// </param>
 public Decorator(Node child)
     : base()
 {
     child_ = child;
 }
예제 #9
0
 /// <summary>Removes the specified child.</summary>
 /// <param name='child'>Node to remove.</param>
 /// <returns>The removed child Node.</returns>
 public Node RemoveChild(Node child)
 {
     Node n = children_.Find(x => x == child);
     children_.Remove(child);
     return n;
 }
예제 #10
0
 /// <summary>Add a new child to the Selector.</summary>
 /// <param name='child'>Child.</param>
 public void AddChild(Node child)
 {
     children_.Add(child);
 }