private void DrawConnections()
        {
            //float lineLength = 100f;
            foreach (MotionMatchingNode n in selectedLayer.nodes)
            {
                if (n.nodeType != MotionMatchingNodeType.Portal)
                {
                    foreach (Transition t in selectedLayer.states[n.stateIndex].transitions)
                    {
                        int toNodeIndex = 0;
                        for (int i = 0; i < selectedLayer.nodes.Count; i++)
                        {
                            if (selectedLayer.nodes[i].ID == t.nodeID)
                            {
                                toNodeIndex = i;
                                break;
                            }
                        }


                        t.transitionRect.position = (n.output.center + selectedLayer.nodes[toNodeIndex].input.center) / 2f - t.transitionRect.size / 2f;

                        if (t == selectedTransition)
                        {
                            DrawTransition(
                                t.transitionRect,
                                n.output.center,
                                selectedLayer.nodes[toNodeIndex].input.center,
                                Color.yellow,
                                GUIResources.GetSelectedConnectionTexture()
                                );
                        }
                        else if (selectedLayer.nodes[toNodeIndex].nodeType == MotionMatchingNodeType.Portal)
                        {
                            DrawTransition(
                                t.transitionRect,
                                n.output.center,
                                selectedLayer.nodes[toNodeIndex].input.center,
                                Color.green,
                                GUIResources.GetPortalConnectionTexture()
                                );
                        }
                        else
                        {
                            DrawTransition(
                                t.transitionRect,
                                n.output.center,
                                selectedLayer.nodes[toNodeIndex].input.center,
                                Color.white,
                                GUIResources.GetNormalConnectionTexture()
                                );
                        }
                    }
                }
            }
        }