示例#1
0
        public IEnumerable <NodeConnection> GetSubdividedConnection()
        {
            var direction           = End - Start;
            var subdivideCount      = direction.Length();
            var directionNormalized = direction.Normalized();

            for (int i = 0; i < subdivideCount; i++)
            {
                var subConnectionStart = Start + directionNormalized * i;
                var subConnectionEnd   = Start + directionNormalized * (i + 1);
                var subConnection      = new NodeConnection(subConnectionStart, subConnectionEnd);

                yield return(subConnection);
            }
        }
示例#2
0
        public void UpdatePreview(NodeConnection nodeConnection)
        {
            if (!nodeConnection.Equals(_lastPreviewConnection))
            {
                RemovePreview();

                var subConnections = nodeConnection.GetSubdividedConnection();
                foreach (var subConnection in subConnections)
                {
                    AddPreview(CreateNodeConnectionView(subConnection));
                }
            }

            _lastPreviewConnection = nodeConnection;
        }
示例#3
0
 public bool Equals(NodeConnection other)
 {
     return
         (Start.Equals(other.Start) && End.Equals(other.End) ||
          Start.Equals(other.End) && End.Equals(other.Start));
 }
示例#4
0
 private static Quaternion GetRotationFromConnectionEnd(NodeConnection connection)
 {
     return(Quaternion.FromToRotation(Vector3.forward, (connection.End - connection.Start).ToV3()));
 }