void DrawLineBetweenNodes(Node n1, Node n2, Color?color = null)
{
var n1Rect = CalculateAbsoluteRectForNode(n1);
var n2Rect = CalculateAbsoluteRectForNode(n2);
var isOnSameLine = Mathf.Abs(n2Rect.x - n1Rect.x) < 40f;
var side = Mathf.Sign(n2Rect.x - n1Rect.x);
var n1Point = n1Rect.center + Vector2.right * n1Rect.width * 0.5f * side;
var n2Point = n2Rect.center - Vector2.right * n2Rect.width * 0.5f * side;
if (isOnSameLine)
{
n2Point = n2Rect.center + Vector2.right * n2Rect.width * 0.5f * side;
}
Vector2 startHandle = n1Point;
startHandle.x = n2Point.x;
Vector2 endHandle = n2Point;
endHandle.x = n1Point.x;
Drawing.DrawBezierLine(n1Point, startHandle, n2Point, endHandle, Color.black * 0.5f, 3.0f, true, 12);
Drawing.DrawLine(n2Point, n2Point + Vector2.left * 5f * side + Vector2.up * 3f, Color.black * 0.5f, 2.0f, true);
Drawing.DrawLine(n2Point, n2Point + Vector2.left * 5f * side - Vector2.up * 3f, Color.black * 0.5f, 2.0f, true);
Drawing.DrawBezierLine(n1Point, startHandle, n2Point, endHandle, color == null ? Color.white : color.Value, 1.0f, true, 24);
Drawing.DrawLine(n2Point, n2Point + Vector2.left * 5f * side + Vector2.up * 3f, color == null ? Color.white : color.Value, 1.0f, true);
Drawing.DrawLine(n2Point, n2Point + Vector2.left * 5f * side - Vector2.up * 3f, color == null ? Color.white : color.Value, 1.0f, true);
}