protected void OnClickPin(ConnectionPin pin)
        {
            if (selectedPin == null)
            {
                selectedPin = pin;
                return;
            }

            if (selectedPin is InputConnectionPin inPin && pin is OutputConnectionPin outPin)
            {
                window.CreateConnection(inPin, outPin);
            }
Esempio n. 2
0
        public void DrawDraggedLine(ConnectionPin connectionPin, Vector2 mousePosition)
        {
            var pinCenter = connectionPin.rect.center;

            if (connectionPin is InputConnectionPin)
            {
                Handles.DrawBezier(pinCenter, mousePosition,
                                   pinCenter + bezierOffset, mousePosition - bezierOffset,
                                   Color.white, null, defaultHandleWidth);

                GUI.changed = true;
            }
            else if (connectionPin is OutputConnectionPin)
            {
                Handles.DrawBezier(pinCenter, mousePosition,
                                   pinCenter - bezierOffset, mousePosition + bezierOffset,
                                   Color.white, null, defaultHandleWidth);

                GUI.changed = true;
            }
        }