/// <summary>
        /// Helper for add new BehaviourTreeCondition node.
        /// </summary>
        /// <param name="condition">Condition.</param>
        public BehaviourTreeCondition <T> When <T> (BehaviourTreeNodeBase condition) where T : class, new ()
        {
            var node = new BehaviourTreeCondition <T> (condition);

            AddChild(node);
            return(node);
        }
 /// <summary>
 /// Adds child node to container.
 /// </summary>
 /// <returns>The child.</returns>
 /// <param name="node">Node.</param>
 public BehaviourTreeContainerBase AddChild(BehaviourTreeNodeBase node)
 {
     if (node != null)
     {
         Children.Add(node);
     }
     return(this);
 }
 /// <summary>
 /// Initialize new instance of BehaviourTreeCondition node.
 /// </summary>
 /// <param name="condition">Condition node.</param>
 /// <param name="successNode">Node for processing on successful condition.</param>
 public BehaviourTreeCondition(BehaviourTreeNodeBase condition, BehaviourTreeNodeBase successNode = null)
 {
     if (condition == null)
     {
         throw new ArgumentNullException();
     }
     _condition = condition;
     _node      = successNode;
 }
 /// <summary>
 /// Helper for add new BehaviourTreeAction node.
 /// </summary>
 /// <param name="node">Node.</param>
 public BehaviourTreeContainerBase Then(BehaviourTreeNodeBase node)
 {
     AddChild(node);
     return(this);
 }
 /// <summary>
 /// Set node for processing on successful condition.
 /// </summary>
 /// <param name="successNode">Node for processing on successful condition.</param>
 public BehaviourTreeCondition <T> Then(BehaviourTreeNodeBase successNode)
 {
     _node = successNode;
     return(this);
 }