Exemplo n.º 1
0
 /// <summary>
 /// Draws a node connection from start to end with specified vectors
 /// </summary>
 public static void DrawConnection(Vector2 startPos, Vector2 startDir, Vector2 endPos, Vector2 endDir, ConnectionDrawMethod drawMethod, Color col)
 {
     if (drawMethod == ConnectionDrawMethod.Bezier)
     {
         float dirFactor = 80;//Mathf.Pow ((startPos-endPos).magnitude, 0.3f) * 20;
         //Debug.Log ("DirFactor is " + dirFactor + "with a bezier lenght of " + (startPos-endPos).magnitude);
         RTEditorGUI.DrawBezier (startPos, endPos, startPos + startDir * dirFactor, endPos + endDir * dirFactor, col * Color.gray, null, 3);
     }
     else if (drawMethod == ConnectionDrawMethod.StraightLine)
         RTEditorGUI.DrawLine (startPos, endPos, col * Color.gray, null, 3);
 }
Exemplo n.º 2
0
 public static void DrawConnection(Vector2 startPos, Vector2 startDir, Vector2 endPos, Vector2 endDir, ConnectionDrawMethod drawMethod, Color col)
 {
     if (drawMethod == ConnectionDrawMethod.Bezier)
     {
         float dirFactor = 80;
         RTEditorGUI.DrawBezier(startPos, endPos, startPos + startDir * dirFactor, endPos + endDir * dirFactor, col * Color.gray, null, 6);
     }
     else if (drawMethod == ConnectionDrawMethod.StraightLine)
     {
         RTEditorGUI.DrawLine(startPos, endPos, col * Color.gray, null, 3);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Draws a node connection from start to end with specified vectors
 /// </summary>
 public static void DrawConnection(Vector2 startPos, Vector2 startDir, Vector2 endPos, Vector2 endDir, ConnectionDrawMethod drawMethod, Color col)
 {
     if (drawMethod == ConnectionDrawMethod.Bezier)
     {
         NodeEditorGUI.OptimiseBezierDirections(startPos, ref startDir, endPos, ref endDir);
         float dirFactor = 80;                //Mathf.Pow ((startPos-endPos).magnitude, 0.3f) * 20;
         //Debug.Log ("DirFactor is " + dirFactor + "with a bezier lenght of " + (startPos-endPos).magnitude);
         RTEditorGUI.DrawBezier(startPos, endPos, startPos + startDir * dirFactor, endPos + endDir * dirFactor, col * Color.gray, null, 3);
     }
     else if (drawMethod == ConnectionDrawMethod.StraightLine)
     {
         RTEditorGUI.DrawLine(startPos, endPos, col * Color.gray, null, 3);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Draws a node connection from start to end, horizontally
        /// </summary>
        public static void DrawConnection(Vector2 startPos, Vector2 endPos, ConnectionDrawMethod drawMethod, Color col)
        {
            Vector2 startVector = startPos.x <= endPos.x? Vector2.right : Vector2.left;

            DrawConnection(startPos, startVector, endPos, -startVector, drawMethod, col);
        }
        public static void DrawConnection(Vector2 startPos, Vector2 startDir, Vector2 endPos, Vector2 endDir, ConnectionDrawMethod drawMethod, Color col)
        {
            switch (drawMethod)
            {
            case ConnectionDrawMethod.Bezier:
            {
                float d = 80f;
                RTEditorGUI.DrawBezier(startPos, endPos, startPos + startDir * d, endPos + endDir * d, col * Color.gray, null, 3f);
                break;
            }

            case ConnectionDrawMethod.StraightLine:
                RTEditorGUI.DrawLine(startPos, endPos, col * Color.gray, null, 3f);
                break;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Draws a node connection from start to end with specified vectors
        /// </summary>
        public static void DrawConnection(Vector2 startPos, Vector2 startDir, Vector2 endPos, Vector2 endDir, ConnectionDrawMethod drawMethod, Color col)
        {
            if (drawMethod == ConnectionDrawMethod.Bezier)
            {
                float dirFactor = 80;                //Mathf.Pow ((startPos-endPos).magnitude, 0.3f) * 20;
                //Debug.Log ("DirFactor is " + dirFactor + "with a bezier lenght of " + (startPos-endPos).magnitude);

                Color coluse = col;
                coluse.r += Node.m_Saturation;
                coluse.g += Node.m_Saturation;
                coluse.b += Node.m_Saturation;
                coluse.r  = Mathf.Clamp01(coluse.r);
                coluse.g  = Mathf.Clamp01(coluse.g);
                coluse.b  = Mathf.Clamp01(coluse.b);
                coluse.r *= Node.m_WireColbright;
                coluse.g *= Node.m_WireColbright;
                coluse.b *= Node.m_WireColbright;

                RTEditorGUI.DrawBezier(startPos, endPos, startPos + startDir * dirFactor, endPos + endDir * dirFactor, coluse, null, Node.m_WireSize);
                Vector2 sp = startPos + Vector2.one * Node.m_DropShadowOffset;
                Vector2 ep = endPos + Vector2.one * Node.m_DropShadowOffset;
                col   = Color.black;
                col.a = Node.m_DropShadowMult2;
                RTEditorGUI.DrawBezier(sp, ep, sp + startDir * dirFactor, ep + endDir * dirFactor, col * Color.black, null, Node.m_WireSize2);
            }
            else if (drawMethod == ConnectionDrawMethod.StraightLine)
            {
                RTEditorGUI.DrawLine(startPos, endPos, col * Color.gray, null, 3);
            }
        }