Exemplo n.º 1
0
        void RefreshAll()
        {
            DrawLine lineDrawer = transform.GetComponent <DrawLine>();

            if (lineDrawer != null)
            {
                lineDrawer.refresh = true;
            }

            for (int i = 0; i < allPoints.Count; i++)
            {
                DrawLineIndividual line = allPoints[i].transform.GetComponent <DrawLineIndividual>();
                if (line != null)
                {
                    line.refresh = true;
                }
            }
        }
Exemplo n.º 2
0
        void OnSceneGUI()
        {
            DrawLineIndividual t = target as DrawLineIndividual;

            if (t == null)
            {
                return;
            }

            if (t.ConnectedPoints.Count == 0)
            {
                t.ConnectedPoints.AddRange(t.transform.GetComponent <Point>().neighbors);
            }

            for (int i = 0; i < t.ConnectedPoints.Count; i++)
            {
                Neighbor currentNeighbor = t.ConnectedPoints[i];

                if (currentNeighbor.target == null)
                {
                    continue;
                }

                Vector3 start = t.transform.position;
                Vector3 goal  = currentNeighbor.target.transform.position;

                switch (currentNeighbor.cType)
                {
                case ConnectionType.leap:
                    Handles.color = Color.red;
                    break;

                case ConnectionType.inBetween:
                    Handles.color = Color.green;
                    break;
                }

                Handles.DrawLine(start, goal);
                t.refresh = false;
            }
        }
Exemplo n.º 3
0
            void OnSceneGUI()
            {
                DrawLineIndividual t = target as DrawLineIndividual;

                if (t == null)
                {
                    return;
                }

                if (t.ConnectedPoints.Count == 0)
                {
                    t.ConnectedPoints.AddRange(t.transform.GetComponent <Point>().neighbours);
                }

                for (int i = 0; i < t.ConnectedPoints.Count; i++)
                {
                    if (t.ConnectedPoints[i].target == null)
                    {
                        continue;
                    }

                    Vector3 pos1 = t.transform.position;
                    Vector3 pos2 = t.ConnectedPoints[i].target.transform.position;

                    switch (t.ConnectedPoints[i].cType)
                    {
                    case ConnectionType.direct:
                        Handles.color = Color.red;
                        break;

                    case ConnectionType.inBetween:
                        Handles.color = Color.green;
                        break;
                    }
                    Handles.DrawLine(pos1, pos2);
                    t.refresh = false;
                }
            }
Exemplo n.º 4
0
        void OnSceneGUI()
        {
            DrawLineIndividual t = target as DrawLineIndividual;

            if (t.point == null)
            {
                Debug.LogError("No point");
                return;
            }

            foreach (var connectedPoint in t.point.neighbours)
            {
                if (connectedPoint.target == null)
                {
                    continue;
                }

                var pos1 = t.transform.position;
                var pos2 = connectedPoint.target.transform.position;

                DrawConnectionLine(pos1, pos2, connectedPoint.cType);
            }
        }