Ejemplo n.º 1
0
        public static void DrawLinearConnection(SF_Editor editor, Vector2 p0, Vector2 p1, float offset, Color col)
        {
            p0 = editor.nodeView.ZoomSpaceToScreenSpace(p0);
            p1 = editor.nodeView.ZoomSpaceToScreenSpace(p1);

            p0 += new Vector2(0f, offset);
            p1 += new Vector2(0f, offset);

            GUILines.DrawLine(p0, p1, col, connectionWidth, true);
        }
Ejemplo n.º 2
0
        public static void DrawDashedLine(SF_Editor editor, Vector2 p0, Vector2 p1, Color col, float dashLength)
        {
//			p0 = editor.nodeView.ZoomSpaceToScreenSpace( p0 );
//			p1 = editor.nodeView.ZoomSpaceToScreenSpace( p1 );

            float frac = dashLength / (p0 - p1).magnitude;

            //int segcount = Mathf.Max(1, Mathf.RoundToInt(1f/frac));

            for (float t = 0; t < 1; t += frac * 2f)
            {
                float tNext = Mathf.Min(1f, t + frac);

                GUILines.DrawLine(Vector2.Lerp(p0, p1, t), Vector2.Lerp(p0, p1, tNext), col, connectionWidth, true);
            }
        }
Ejemplo n.º 3
0
        public static void DrawRectilinearConnection(SF_Editor editor, Vector2 p0, Vector2 p1, float offset, Color col)
        {
            p0 = editor.nodeView.ZoomSpaceToScreenSpace(p0);
            p1 = editor.nodeView.ZoomSpaceToScreenSpace(p1);

            p0 += new Vector2(0f, offset);
            p1 += new Vector2(0f, offset);


            Vector2 p0t = new Vector2((p0.x + p1.x) / 2f + (p0.y < p1.y ? -offset : offset), p0.y);
            Vector2 p1t = new Vector2(p0t.x, p1.y);


            GUILines.DrawLine(p0, p0t, col, connectionWidth, true);
            GUILines.DrawLine(p0t, p1t, col, connectionWidth, true);
            GUILines.DrawLine(p1t, p1, col, connectionWidth, true);
        }