public NodeConnection(Node child, Node parent, TreeMaker treeMaker, bool isLoadingConnection = false, bool isSavingConnection = false) { if (child == null && parent == null) { Debug.LogError("No start nor end node was given! Connection not created!"); return; } if (child != null) { childNode = child; childPoint = child.parentConnectionPoint; } if (parent != null) { parentNode = parent; parentPoint = parent.childConnectionPoint; } if (!isLoadingConnection) { treeMaker.SetCurrentConnection(this); } if (!isSavingConnection) { treeMaker.AddNodeConnection(this); } this.treeMaker = treeMaker; }
public void FinishConnection(Node n) { if (parentNode == null) { parentNode = n; childNode.SetParent(parentNode); parentNode.AddChild(childNode); } else { childNode = n; parentNode.AddChild(childNode); childNode.SetParent(parentNode); } treeMaker.SetCurrentConnection(null); }