/// <summary> /// Creates connection between one node to another. The connection is one one-way and tries to prevent circular to prevent infinity loops. /// </summary> /// <param name="from">A node that is higher in hierarchy.</param> /// <param name="to">A node that is lower in hierarchy.</param> /// <returns>True if connection succeed. Otherwise false.</returns> public bool ConnectNodes(AFlowNode from, ANode to) { if (_nodes.Contains(from) && _nodes.Contains(to) && to != Root) { var n = to as AFlowNode; if (n != null) { //check nodes recursive to prevent circular trees if (IsConnected(from, n)) { return(false); } } return(from.AddNode(to)); } return(false); }
/// <summary> /// Creates connection between one node to another. The connection is one one-way and tries to prevent circular to prevent infinity loops. /// </summary> /// <param name="from">A node that is higher in hierarchy.</param> /// <param name="to">A node that is lower in hierarchy.</param> /// <returns>True if connection succeed. Otherwise false.</returns> public bool ConnectNodes(AFlowNode from, ANode to) { if (_nodes.Contains(from) && _nodes.Contains(to) && to != Root) { var n = to as AFlowNode; if (n != null) { //check nodes recursive to prevent circular trees if (IsConnected(from, n)) { return false; } } return from.AddNode(to); } return false; }