Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }