public virtual void AddConnection(SplineComputer computer, int pointIndex) { RemoveInvalidConnections(); for (int i = 0; i < computer.nodeLinks.Length; i++) { if (computer.nodeLinks[i].pointIndex == pointIndex) { Debug.LogError("Connection has been already added in " + computer.nodeLinks[i].node); return; } } SplinePoint point = computer.GetPoint(pointIndex); point.SetPosition(transform.position); Connection newConnection = new Connection(computer, pointIndex, PointToLocal(point)); Connection[] newConnections = new Connection[connections.Length + 1]; connections.CopyTo(newConnections, 0); newConnections[connections.Length] = newConnection; connections = newConnections; SetPoint(connections.Length - 1, point); computer.AddNodeLink(this, pointIndex); UpdateConnectedComputers(); }
public virtual void AddConnection(SplineComputer computer, int pointIndex) { RemoveInvalidConnections(); for (int i = 0; i < computer.nodeLinks.Length; i++) { if (computer.nodeLinks[i].pointIndex == pointIndex) { UnityEngine.Debug.LogError("Connection has been already added in " + computer.nodeLinks[i].node); return; } } SplinePoint point = computer.GetPoint(pointIndex); point.SetPosition(base.transform.position); Connection connection = new Connection(computer, pointIndex, PointToLocal(point)); Connection[] array = new Connection[connections.Length + 1]; connections.CopyTo(array, 0); array[connections.Length] = connection; connections = array; SetPoint(connections.Length - 1, point, swappedTangents: true); computer.AddNodeLink(this, pointIndex); UpdateConnectedComputers(); }