private void DrawGUIDisplayForNodes()
        {
            if (!showNodeIDsInTheScene)
            {
                return;
            }

            Node    currNode;
            Vector2 guiPosition;

            Handles.BeginGUI();

            for (int i = 0; i < script.graphData.nodes.Count; i++)
            {
                currNode    = script.graphData.nodes[i];
                guiPosition = HandleUtility.WorldToGUIPoint(currNode.Position);
                GUI.Label(new Rect(guiPosition.x - 10, guiPosition.y - 30, 20, 20), "<Color=" + nodeGUITextColor + ">" + currNode.autoGeneratedID.ToString() + "</Color>", CustomGUI.GetStyleWithRichText());
            }
            Handles.EndGUI();
        }
        private void ShowNodesAndPathInInspector()
        {
            script.graphData.nodeSize                = EditorGUILayout.Slider("Node gizmo Size", script.graphData.nodeSize, 0.1f, 3f);
            script.graphData.lineColor               = EditorGUILayout.ColorField("Path Color", script.graphData.lineColor);
            script.graphData.lineType                = (PathLineType)EditorGUILayout.EnumPopup("Path Type", script.graphData.lineType);
            script.graphData.heightFromTheGround     = EditorGUILayout.FloatField("Offset from ground( Height )", script.graphData.heightFromTheGround);
            script.graphData.groundColliderLayerName = EditorGUILayout.TextField("Ground collider layer name", script.graphData.groundColliderLayerName);
            EditorGUILayout.Space();
            GUILayout.Label("<size=12><b>Nodes</b></size>", CustomGUI.GetStyleWithRichText());

            if (script.graphData.nodes.Count > 0)
            {
                showNodeIDsInTheScene = EditorGUILayout.Toggle("Show Node IDs in scene", showNodeIDsInTheScene);

                List <Node> nodeList = script.graphData.nodes;
                for (int j = 0; j < nodeList.Count; j++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.LabelField("\t" + "Node <Color=" + nodeGUITextColor + ">" + nodeList[j].autoGeneratedID + "</Color>", CustomGUI.GetStyleWithRichText(), GUILayout.Width(120f));

                        nodeList[j].SetPosition(EditorGUILayout.Vector3Field("", nodeList[j].Position));
                        EditorGUILayout.LabelField("Enable", EditorStyles.miniLabel, GUILayout.Width(50f)); nodeList[j].SetAsOpen(EditorGUILayout.Toggle(nodeList[j].IsOpen));

                        if (GUILayout.Button("+", GUILayout.Width(25f)))
                        {
                            AddNode(nodeList[j].Position + Vector3.right + Vector3.up, j + 1);
                        }
                        if (GUILayout.Button("-", GUILayout.Width(25f)))
                        {
                            DeleteNode(j);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }
            else
            {
                EditorGUILayout.LabelField("<Color=green> Nodes are empty. Use <b>Add Node</b> in scene view to create Nodes!</Color>", CustomGUI.GetStyleWithRichText(CustomGUI.SetAlignmentForText(TextAnchor.MiddleCenter)));
            }
            EditorGUILayout.Space();
            GUILayout.Label("<size=12><b>Paths</b></size>", CustomGUI.GetStyleWithRichText());

            if (script.graphData.paths.Count > 0)
            {
                showPathIDsInTheScene = EditorGUILayout.Toggle("Show Path IDs in scene", showPathIDsInTheScene);
                drawPathsInTheScene   = EditorGUILayout.Toggle("Draw Paths", drawPathsInTheScene);
                showCostsInTheScene   = EditorGUILayout.Toggle("Show Path Costs in scene", showCostsInTheScene);

                List <Path> paths = script.graphData.paths;
                for (int j = 0; j < paths.Count; j++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.LabelField("\t" + "Path <Color=" + pathGUITextColor + ">" + paths[j].autoGeneratedID + "</Color>", CustomGUI.GetStyleWithRichText(), GUILayout.Width(120f));

                        EditorGUILayout.LabelField("From", EditorStyles.miniLabel, GUILayout.Width(30f)); paths[j].IDOfA = EditorGUILayout.IntField(paths[j].IDOfA, GUILayout.Width(50f));
                        EditorGUILayout.LabelField("To", EditorStyles.miniLabel, GUILayout.Width(25f)); paths[j].IDOfB   = EditorGUILayout.IntField(paths[j].IDOfB, GUILayout.Width(50f));
                        EditorGUILayout.LabelField("<Color=" + costGUITextColor + ">" + "Cost" + "</Color>", CustomGUI.GetStyleWithRichText(EditorStyles.miniLabel), GUILayout.Width(30f)); paths[j].cost = EditorGUILayout.IntField(paths[j].cost, GUILayout.Width(50f));

                        EditorGUILayout.LabelField("One Way", EditorStyles.miniLabel, GUILayout.Width(50f)); paths[j].isOneWay = EditorGUILayout.Toggle(paths[j].isOneWay);
                        EditorGUILayout.LabelField("Enable", EditorStyles.miniLabel, GUILayout.Width(50f)); paths[j].isOpen    = EditorGUILayout.Toggle(paths[j].isOpen);

                        if (GUILayout.Button("+", GUILayout.Width(25f)))
                        {
                            AddPath(j + 1);
                        }
                        if (GUILayout.Button("-", GUILayout.Width(25f)))
                        {
                            DeletePath(j);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }
            else
            {
                EditorGUILayout.LabelField("<Color=green> Paths are empty. Use <b>Connect Nodes</b> in scene view to create Paths!</Color>", CustomGUI.GetStyleWithRichText(CustomGUI.SetAlignmentForText(TextAnchor.MiddleCenter)));
            }

            if (GUI.changed)
            {
                MarkThisDirty();
            }
        }
        private void DrawPathLine()
        {
            List <Path> paths = script.graphData.paths;
            List <Node> nodes = script.graphData.nodes;
            Vector3     currNode;
            Vector2     guiPosition;

            if (paths == null || nodes == null)
            {
                return;
            }

            Handles.color = script.graphData.lineColor;
            Node a, b;

            for (int i = 0; i < paths.Count; i++)
            {
                if (!paths[i].isOpen)
                {
                    continue;
                }

                a = b = null;
                if (script.graphData.nodesSorted.ContainsKey(paths[i].IDOfA))
                {
                    a = script.graphData.nodesSorted[paths[i].IDOfA];
                }

                if (script.graphData.nodesSorted.ContainsKey(paths[i].IDOfB))
                {
                    b = script.graphData.nodesSorted[paths[i].IDOfB];
                }

                if (a != null && b != null && a != b && a.IsOpen && b.IsOpen)
                {
                    if (drawPathsInTheScene)
                    {
                        Handles.DrawLine(a.Position, b.Position);
                    }

                    Handles.BeginGUI();
                    {
                        currNode    = (a.Position + b.Position) / 2;
                        guiPosition = HandleUtility.WorldToGUIPoint(currNode);
                        string str = "";
                        if (showPathIDsInTheScene)
                        {
                            str += "<Color=" + pathGUITextColor + ">" + paths[i].autoGeneratedID.ToString() + "</Color>";
                        }
                        if (showCostsInTheScene)
                        {
                            if (!string.IsNullOrEmpty(str))
                            {
                                str += "<Color=" + "#ffffff" + ">" + "  Cost: " + "</Color>";
                            }
                            str += "<Color=" + costGUITextColor + ">" + paths[i].cost.ToString() + "</Color>";
                        }

                        if (!string.IsNullOrEmpty(str))
                        {
                            GUI.Label(new Rect(guiPosition.x - 10, guiPosition.y - 30, 40, 20), str, CustomGUI.GetStyleWithRichText());
                        }
                    }
                    Handles.EndGUI();
                }
            }
            Handles.color = Color.white;
        }