public ArcBehaviour SpawnArc(NodeBehaviour fromNode, NodeBehaviour toNode) { // Set new connection position to average of node positions Vector3 newPos = 0.5f * (fromNode.transform.position + toNode.transform.position); ArcBehaviour newArc = Instantiate(arcPrefab); newArc.transform.position = newPos; newArc.Initialize(fromNode, toNode); ArcBehaviourSpawned.Invoke(newArc); return(newArc); }
private void OnArcBehaviourSpawned(ArcBehaviour arc) { AllArcs.Add(arc); NodeArcsMap[arc.fromNode].Add(arc); NodeArcsMap[arc.toNode].Add(arc); }