public ConstellationNodeLink(ConstellationNode a, ConstellationNode b) { nodeList = new List <ConstellationNode>(); nodeList.Add(a); nodeList.Add(b); a.AddLink(this); b.AddLink(this); }
public ConstellationNodeLink GetLinkTo(ConstellationNode node) { if (abilityNodeLinkList.Count <= node.Index) { return(null); } return(abilityNodeLinkList[node.Index]); }
public void DeepPopulateLinks(int depth) { while (abilityNodeLinkListList.Count <= depth) { abilityNodeLinkListList.Add(new List <ConstellationNodeLink>()); } foreach (var nodeLink in abilityNodeLinkListList[depth - 1]) { //if (nodeLink.Start != this) // continue; bool appendBack = this == nodeLink.Start; ConstellationNode deepdEnd = this != nodeLink.Start ? nodeLink.Start : nodeLink.End; foreach (var directNodeLink in deepdEnd.abilityNodeLinkListList[1]) { //skip lower entries //if (directNodeLink.Start.Index <= Index || directNodeLink.End.Index <= Index) // continue; ConstellationNode directdEnd = deepdEnd != directNodeLink.Start ? directNodeLink.Start : directNodeLink.End; if (directdEnd == this) { continue; } bool foundInShorterLink = false; for (int i = 0; i < depth - 1 && !foundInShorterLink; ++i) { foreach (var otherNodeLink in abilityNodeLinkListList[i]) { if ((this == otherNodeLink.Start && directdEnd == otherNodeLink.End) || (this == otherNodeLink.End && directdEnd == otherNodeLink.Start)) { foundInShorterLink = true; break; } } } //ignore if already linkied with shorter link if (foundInShorterLink) { continue; } //add to this depth new ConstellationNodeLink(nodeLink, directdEnd, appendBack); } } //if this depth has links, try to deep populate them. if (abilityNodeLinkListList[depth].Count > 0) { DeepPopulateLinks(depth + 1); } }
public ConstellationNodeLink(ConstellationNodeLink link, ConstellationNode extensionNode, bool appendBack) { nodeList = new List <ConstellationNode>(); if (appendBack) { nodeList.AddRange(link.nodeList); nodeList.Add(extensionNode); } else { nodeList.Add(extensionNode); nodeList.AddRange(link.nodeList); } this.Start.AddLink(this); this.End.AddLink(this); }