Пример #1
0
 public void AddIncomingEdge(PEdge edge)
 {
     lock (EdgeLists) if (!incomingEdgeList.Contains(edge))
         {
             incomingEdgeList.Add(edge);
         }
 }
Пример #2
0
 public void AddOutgoingEdge(PEdge edge)
 {
     lock (EdgeLists) if (!outgoingEdgeList.Contains(edge))
         {
             outgoingEdgeList.Add(edge);
         }
 }
Пример #3
0
    private void GeneratePieceMesh(PieceData p)
    {
        //use HashSet to prevent double vertices
        HashSet <Vector2> vertices2DSet         = new HashSet <Vector2>();
        HashSet <Vector2> vertices2DColliderSet = new HashSet <Vector2>();

        foreach (Neighbour n in p.neighbours)
        {
            //if this 'neighbour' is the boundary, set edgeType to straight
            if (n.id == -1)
            {
                n.edgeType = PEdge.EdgeType.Straight;
            }

            //else if the edgeType wasn't set to something yet, set it here
            //and also set the corresponding neighbours edgeType to the opposite type
            else if (n.edgeType == PEdge.EdgeType.Nothing)
            {
                PieceData neighbourPiece = GetPieceData(n.id);
                Neighbour meAsNeighbour  = neighbourPiece.GetNeigbourWithID(p.id);

                if (randomBool(p.id))
                {
                    n.edgeType             = PEdge.EdgeType.Shaped;
                    meAsNeighbour.edgeType = PEdge.EdgeType.ShapedInverse;
                }
                else
                {
                    n.edgeType             = PEdge.EdgeType.ShapedInverse;
                    meAsNeighbour.edgeType = PEdge.EdgeType.Shaped;
                }
            }

            PEdge edge          = new PEdge(p.baseVertices[n.v1], p.baseVertices[n.v2], n.edgeType, meshDetail);
            PEdge edgeLowDetail = new PEdge(p.baseVertices[n.v1], p.baseVertices[n.v2], n.edgeType, colliderDetail);

            edge.points.ForEach(point => vertices2DSet.Add(point));
            edgeLowDetail.points.ForEach(point => vertices2DColliderSet.Add(point));
        }

        List <Vector2> vertices2D         = vertices2DSet.ToList();
        List <Vector2> vertices2DCollider = vertices2DColliderSet.ToList();

        //create final visual mesh
        Triangulator triangulator = new Triangulator(vertices2D);

        int[]     triangles = triangulator.Triangulate();
        Vector3[] vertices  = vertices2D.ConvertAll(v2 => new Vector3(v2.x, v2.y, 0f)).ToArray();
        p.mesh = MeshFunctions.ExtrudeFlatPiece(vertices, triangles, thickness);
        ProjectUV(p.mesh, p.position);

        //create final collider mesh
        triangulator = new Triangulator(vertices2DCollider);
        int[]     colliderTriangles = triangulator.Triangulate();
        Vector3[] colliderVertices  = vertices2DCollider.ConvertAll(v2 => new Vector3(v2.x, v2.y, 0f)).ToArray();
        p.colliderMesh = MeshFunctions.ExtrudeFlatPieceNoSplit(colliderVertices, colliderTriangles, thickness);
    }
Пример #4
0
            public PEdge CreateEdgeTo(PNode otherNode)
            {
                if (otherNode == this)
                {
                    return(null);
                }
                PEdge edge = new PEdge(this, otherNode);

                return(edge);
            }
Пример #5
0
 public bool Equals(PEdge other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (other.StartNode == StartNode && other.EndNode == EndNode)
     {
         return(true);
     }
     return(false);
 }
        private Vector2?ExitIntersection()
        {
            if (!polygonBegin.HasValue || PEdge.Cross(QEdge) >= 0)
            {
                return(null);
            }

            SegmentSegmentIntersectionResult?result = SegmentSegmentIntersection(PPrev, P, QPrev, Q);

            if (result.HasValue)
            {
                return(result.Value.position);
            }

            return(null);
        }
        private Vector2?EntranceIntersection()
        {
            if (PEdge.Cross(QEdge) <= 0)
            {
                return(null);
            }

            SegmentSegmentIntersectionResult?result = SegmentSegmentIntersection(PPrev, P, QPrev, Q);

            if (result.HasValue && result.Value.at < 1 && result.Value.bt < 1)
            {
                return(result.Value.position);
            }

            return(null);
        }
Пример #8
0
 void addVertexOnEdge(PEdge e, Vector3 position)
 {
     PVertex v1 = e.v1;
                     PVertex v2 = e.v2;
                     addVertexOnEdge(v1, v2, position);
 }
Пример #9
0
    /// <summary>
    /// Ajoute un Vertex v0 entre v1 et v2 dans la liste et ajoute les ar�tes [v1 v0] et [v2 v0]
    /// v0 sera positionn� selon le param�tre position
    /// </summary>
    void addVertexOnEdge(PVertex v1, PVertex v2,Vector3 position)
    {
        //Si c'est l'ar�tre entre le premier et le dernier vertex ( la rouge), on fait un simple ajout
        if ((v1 == m_vertices.First.Value && v2 == m_vertices.Last.Value) || (v2 == m_vertices.First.Value && v1 == m_vertices.Last.Value))
        {
            removeEdge(m_vertices.First.Value, m_vertices.Last.Value);
            addVertex(position);
            addEdge(m_vertices.First.Value, m_vertices.Last.Value, true);
            m_vertexSelected = null;
            m_edgeSelected = null;

            //on remet le nouveau en vert
            PVertex selected = m_vertices.Last.Value;
            selected.gameObject.GetComponent<Renderer>().material.SetColor("_Color",SELECTED_COLOR);
        }
        else
        { //sinon on cr�e un nouveau vertex, ins�r� au bon endroit dans la liste
            PVertex vNew = new PVertex();
            vNew.gameObject = createVertexObject(position);
            LinkedListNode<PVertex> n1 = m_vertices.Find(v1);
            LinkedListNode<PVertex> n2 = m_vertices.Find(v2);
            if (n1.Next == n2)
            {
                m_vertices.AddAfter(n1, vNew);
            }
            else
                m_vertices.AddAfter(n2, vNew);
            addEdge(vNew, v1);
            addEdge(vNew, v2);
            removeEdge(v1, v2);
            m_vertexSelected = vNew;
            m_edgeSelected = null;

            //on remet le nouveau en vert
            m_vertexSelected.gameObject.GetComponent<Renderer>().material.SetColor("_Color",SELECTED_COLOR);
        }
    }
Пример #10
0
    /// <summary>
    /// Ajoute une ar�te entre les vertex v1 et v2.
    /// � l'ar�te est associ�e un gameobject constitu� d'une mesh repr�sentative et d'une mesh tr�s haute et fine servant aux collisions
    /// </summary>
    private void addEdge(PVertex v1, PVertex v2,bool lastEdge=false,bool rendererEnabled=true)
    {
        PEdge e = new PEdge();
        e.v1 = v1;
        e.v2 = v2;

        v1.linked.Add(v2);
        v2.linked.Add(v1);
        e.gameObject = createEdgeObject();
        /*if (lastEdge)
        {
            e.gameObject.transform.FindChild("line").renderer.material = m_matLastEdge;
        }*/
        e.gameObject.transform.position = (e.v1.Position+ e.v2.Position) / 2;
        e.gameObject.transform.LookAt(v1.Position);
        e.gameObject.transform.parent = null;
        e.gameObject.transform.localScale = new Vector3( e.gameObject.transform.localScale.x, e.gameObject.transform.localScale.y, Vector3.Distance(e.v1.Position, e.v2.Position));
        e.gameObject.transform.parent = this.gameObject.transform;
        m_edges.Add(e);
        if (!rendererEnabled)
        {
            e.gameObject.GetComponentInChildren<MeshRenderer>().enabled = false;
        }
    }
Пример #11
0
 /// <summary>
 /// S'il existe une ar�te ayant pour GameObject celui pass� en param�tre alors m_edgeSelected prend sa valeur.
 /// Sinon m_edgeSelected aura pour nouvelle valeur null.
 /// </summary>
 public void selectEdgeFromGameObject(GameObject go)
 {
     m_edgeSelected = null;
     foreach (PEdge e in m_edges)
     {
         if (e.gameObject.transform.FindChild("line").gameObject == go)
         {
             m_edgeSelected = e;
             break;
         }
     }
 }
Пример #12
0
    public void OnGUI()
    {
        if (m_showGUI)
        {
            GUISkin backup = GUI.skin;
            GUI.skin = m_skin;

            GUILayout.BeginArea(m_uiArea);
            GUILayout.FlexibleSpace();
            GUILayout.Box("", "UP", GUILayout.Width(280), GUILayout.Height(150));
            GUILayout.BeginVertical("MID");

            //m_uiRects contiens les rectangles des �l�ments du menu afin de savoir si la souris est dessus ou pas
            m_uiRects = new List<Rect>();

            //Bouton Material
            GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(TextManager.GetText("GUIMenuConfiguration.Materials"), "Menu", GUILayout.Height(50), GUILayout.Width(280)))
            {
                //Parfois la plage deviens vert s�lectionn�e quand on change sons material, ce serait mieux pas...
                mainScene.GetComponent<GUIMenuInteraction>().isConfiguring = true;
                Camera.main.GetComponent<ObjInteraction>().setSelected(gameObject);
                Camera.main.GetComponent<ObjInteraction>().setActived(false);

                mainScene.GetComponent<GUIMenuConfiguration>().enabled = true;
                mainScene.GetComponent<GUIMenuConfiguration>().setVisibility(true);
                mainScene.GetComponent<GUIMenuConfiguration>().OpenMaterialTab();

                mainScene.GetComponent<GUIMenuLeft>().canDisplay(false);
                mainScene.GetComponent<GUIMenuRight>().canDisplay(false);
                hideGUI();
                m_editingMode = false;
                hideVertices();

                //G�n�ration de la mesh si ce n'a pas �t� fait
                if (m_plageMesh == null)
                {
                    //Les colliders sont d�sactiver apr�s la cr�ation de la mesh pour pas interf�rer avec le fonctionnement de oneshot
                    m_disableCollidersAfterCreatingMesh = true;
                    StartCoroutine(generatePolygons());
                }
                m_edgeSelected = null;
            }
            //Ajout � la liste de rectangle celui correspondant au bouton
            m_uiRects.Add(GUILayoutUtility.GetLastRect());
            GUILayout.Space(20);
            GUILayout.EndHorizontal();

            //Bouton configurer => quand on clique dessus, �a masque la gui pour revenir au menu pr�c�dent
            GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
            GUILayout.FlexibleSpace();
            if (!GUILayout.Toggle(true, TextManager.GetText("Terrasse.Configurer"), "Menu", GUILayout.Height(50), GUILayout.Width(280)))
            {
                if (m_plageMesh == null)
                {
                    m_disableCollidersAfterCreatingMesh = true;
                    StartCoroutine(generatePolygons());
                }
                exitConfigurator(true);
                hideGUI();
            }
            m_uiRects.Add(GUILayoutUtility.GetLastRect());
            GUILayout.Space(20);
            GUILayout.EndHorizontal();

            //editing_mode est activ� quand l'utilisateur �dite le contours
            if (m_editingMode)
            {
                //Bouton pour quitter l'editing mode et g�n�rer la mesh
                GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
                GUILayout.FlexibleSpace();
                if (!GUILayout.Toggle(true, TextManager.GetText("Terrasse.Edit"), "Menu", GUILayout.Height(50), GUILayout.Width(280)))
                {
                    m_editingMode = false;
                    hideVertices();
                    if(m_plageMesh==null)
                        StartCoroutine(generatePolygons());
                    m_edgeSelected = null;
                }
                GUILayout.Space(20);
                GUILayout.EndHorizontal();
                m_uiRects.Add(GUILayoutUtility.GetLastRect());

                //Bouton pour supprimer un Vertex, uniquement disponible s'il y a plus de 3 Vertices
                if (m_vertices.Count > 3)
                {
                    GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(TextManager.GetText("Terrasse.Delete"), "Menu", GUILayout.Height(50), GUILayout.Width(280)))
                    {
                        Debug.Log("selected : " + m_vertexSelected);
                        PVertex todel = null;

                        //Si un Vertex est s�lection�e, on le suprime
                        if (m_vertexSelected != null)
                        {
                            todel = m_vertexSelected;
                        }
                         //Sinon on suprime le dernier vertex de la liste
                        else if (m_vertices.Count > 0)
                        {
                            todel = m_vertices.Last.Value;
                        }
                        Debug.Log("Suppression points :" + todel.ToString());
                        if (todel != null)
                        {
                            if (todel.linked.Count > 1)
                            {
                                if (todel == m_vertices.First.Value || todel == m_vertices.Last.Value)
                                    addEdge(todel.linked[0], todel.linked[1], true);
                                else
                                    addEdge(todel.linked[0], todel.linked[1]);
                                deleteEar(todel, todel.linked[0], todel.linked[1], true);
                            }
                            else if (todel.linked.Count > 0)
                                deleteEar(todel, todel.linked[0], null, true);
                            else
                                deleteEar(todel, null, null, true);
                        }
                        m_vertexSelected = null;
                        //on remet le premier en vert
                        if (m_vertices.Count > 0)
                        {
                            PVertex selected = m_vertices.Last.Value;
                            selected.gameObject.GetComponent<Renderer>().material.SetColor("_Color",SELECTED_COLOR);
                        }
                    }
                    m_uiRects.Add(GUILayoutUtility.GetLastRect());
                    GUILayout.Space(20);
                    GUILayout.EndHorizontal();
                }

                GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(TextManager.GetText("Terrasse.Generate"), "Menu", GUILayout.Height(50), GUILayout.Width(280)))
                {
                    Debug.Log("genrere terasse clicked");
                    m_editingMode = false;
                    hideVertices();
                    StartCoroutine(generatePolygons());
                    m_edgeSelected = null;
                }
                m_uiRects.Add(GUILayoutUtility.GetLastRect());
                GUILayout.Space(20);
                GUILayout.EndHorizontal();

            }
            else
            {

                if (m_thicknessString == null)
                {
                    m_thicknessString = (Mathf.Ceil(m_thickness * 100) / 100).ToString();
                }

                GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
                GUILayout.FlexibleSpace();
                if (GUILayout.Toggle(false, TextManager.GetText("Terrasse.Edit"), "Menu", GUILayout.Height(50), GUILayout.Width(280)))
                {
                    Destroy(m_plageMesh);
                    m_editingMode = true;
                    hideGUITimer = Time.time;
                    m_thicknessMode = false;
                    showVertices();

                    //on met le dernier point en vert
                    if (m_vertexSelected != null)
                    {
                        //PVertex selected = m_vertexSelected;
                        m_vertexSelected.gameObject.GetComponent<Renderer>().material.SetColor("_Color",SELECTED_COLOR);
                    }
                    else if (m_vertices.Count > 0)
                    {
                        PVertex selected = m_vertices.Last.Value;
                        selected.gameObject.GetComponent<Renderer>().material.SetColor("_Color",SELECTED_COLOR);
                    }
                }
                GUILayout.Space(20);
                GUILayout.EndHorizontal();

            }

        //Epaisseur
          /*  bool oldthickMode = m_thicknessMode;
            GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
            GUILayout.FlexibleSpace();
            m_thicknessMode = GUILayout.Toggle(m_thicknessMode, "R�glage �paisseur", "Menu", GUILayout.Height(50), GUILayout.Width(280));
            m_uiRects.Add(GUILayoutUtility.GetLastRect());
            GUILayout.Space(20);
            GUILayout.EndHorizontal();

            if (m_thicknessMode && !oldthickMode)
            {
                m_editingMode = false;
                hideVertices();
                if(m_plageMesh==null)
                   StartCoroutine(generatePolygons());
                m_edgeSelected = null;
                // Camera.mainCamera.GetComponent<ObjInteraction>().setActived(true);
            }
            if (m_thicknessMode)
            {

                GUILayout.BeginHorizontal("", "bg", GUILayout.Height(50), GUILayout.Width(280));
                GUILayout.FlexibleSpace();
                if (GUILayout.RepeatButton("+", "btn+", GUILayout.Height(50), GUILayout.Width(50)))
                {
                    Debug.Log("Xplus pressed");
                    setPlageThickness(m_thickness + c_thicknessDelta);
                    m_thicknessString = (Mathf.Ceil(m_thickness * 100) / 100).ToString();
                }
                string tempText = GUILayout.TextField(m_thicknessString, GUILayout.Height(50), GUILayout.Width(50));
                bool minusPressed = false;
                if (GUILayout.RepeatButton("-", "btn-", GUILayout.Height(50), GUILayout.Width(50)))
                {
                    Debug.Log("Xminus pressed");
                    minusPressed = true;
                    if (m_thickness - c_thicknessDelta >= 0)
                    {
                        Debug.Log(">0");
                        setPlageThickness(m_thickness - c_thicknessDelta);
                        Debug.Log("Xminus pressed");
                        m_thicknessString = (Mathf.Ceil(m_thickness * 100) / 100).ToString();
                    }
                    else
                    {
                        setPlageThickness(0);
                        m_thicknessString = "0";
                    }

                }
                if (!tempText.Equals(m_thicknessString) && !minusPressed)
                {

                    try
                    {
                        Debug.Log("parsing newScalex");
                        float newThickness = float.Parse(tempText.Replace(',', '.'));
                        if (newThickness > 0)
                        {
                            Debug.Log("newscaleX>0");
                            setPlageThickness(newThickness);
                            m_thicknessString = tempText;
                        }
                        else
                        {

                            setPlageThickness(0);
                            if (newThickness == 0)
                            {
                                Debug.Log("newscaleX=0");
                                m_thicknessString = tempText;
                            }
                            else
                            {
                                Debug.Log("newscaleX=0");
                                m_thicknessString = "0";
                            }
                        }
                    }
                    catch (UnityException e)
                    {
                        Debug.Log("exception : " + e.ToString());
                        if (tempText.Equals(""))
                        {
                            Debug.Log("temptext=''");
                            m_thicknessString = "0";
                            setPlageThickness(0);
                        }
                        else
                        {
                            m_thicknessString = (Mathf.Ceil(m_thickness * 100) / 100).ToString();
                        }
                    }

                }
                //GUILayout.Label("Epaisseur", GUILayout.Width(60));
                GUILayout.Space(20);
                GUILayout.EndHorizontal();
            }*/

            GUILayout.EndVertical();
            GUILayout.Box("", "DWN", GUILayout.Width(280), GUILayout.Height(150));//fade en bas

            GUILayout.FlexibleSpace();

            GUILayout.EndArea();

            GUI.skin = backup;

        }
    }
Пример #13
0
    // Update is called once per frame
    void Update()
    {
        //Mode �dition
        if (m_editingMode)
        {
            bool oldShowGui = m_showGUI;

            //met � jour clickedOnUI pour voir si la souris est sur le menu
            updateOnUI();

            m_showGUI = true;

            if (PC.In.Click1Up())
            {
                _justeSelected=false;
                //Si relachement click et souris pas sur le menu, on affiche le menu
                if (clickedOnUI || PC.In.GetCursorPos().x <= Screen.width - 280)
                {
                    //Debug.Log("showing gui because click one up and not cursor on the ui position");
                    hideGUITimer = Time.time;//remettre hideGUITimer � Time.time permet d'afficher le menu pour quelque secondes
                    mainScene.GetComponent<GUIMenuConfiguration>().ShowHelpPannel = false;
                }
                else
                {
                    Debug.Log("hiding GUI because click1Up and mouse not on ui");
                    hideGUI();
                }

            }

            //Si 2 secondes se sont pass� depuis la derni�re mis � jour de hideGUITimer, on cache le menu
            if (Time.time - hideGUITimer > 2f)
            {
                hideGUI();
            }

            if (!clickedOnUI)
            {
                                //click pas sur le menu
                if (PC.In.Click1Down())
                {
                    //raycast
                    RaycastHit vHit = new RaycastHit();
                    RaycastHit vHitEdge = new RaycastHit();
                    Ray vRay = Camera.main.ScreenPointToRay(PC.In.GetCursorPos());

                    //Si on clicke pas sur un vertex
                    if (!Physics.Raycast(vRay, out vHit, 1000, 1 << LayerMask.NameToLayer("vertexplage")))
                    {
                        //Ar�te s�lectionn�e
                        if (Physics.Raycast(vRay, out vHitEdge, 1000, 1 << LayerMask.NameToLayer("edgeplage")))
                        {
                          //  Debug.Log("edge selected");
                            //on remet l'ancien vertex en bleu
                            if (m_vertexSelected != null)
                            {
                                m_vertexSelected.gameObject.GetComponent<Renderer>().material.SetColor("_Color",UNSELECTED_COLOR);
                            }
                            else if (m_vertices.Count > 0)
                            {
                                PVertex selected = m_vertices.Last.Value;
                                selected.gameObject.GetComponent<Renderer>().material.SetColor("_Color",UNSELECTED_COLOR);
                            }
                            m_vertexSelected = null;
                            selectEdgeFromGameObject(vHitEdge.collider.gameObject);
                            //ajout d'un vertex sur l'ar�te s�lectionn�e
                            addVertexOnEdge(m_edgeSelected, vHitEdge.point);
                            _justeSelected = true;
                        }
                        //Rien de s�lectionn�e -> on enleve le fonction ajout d'un point dans le vide
                        /*else if (Physics.Raycast(vRay, out vHit, 1000, 1 << LayerMask.NameToLayer("grid")))
                        {
                            //Ajout d'un Vertex, entre le premier et le dernier
                            addVertexOnEdge(m_vertices.First.Value, m_vertices.Last.Value, vHit.point);
                            m_vertexSelected = null;
                            m_edgeSelected = null;

                        }*/

                    }
                    else
                    {
                        //S�lection d'un vertex
                        Debug.Log("select a vertex");
                        GameObject vgo = vHit.collider.gameObject;
                        if (vgo != null)
                        {
                            selectVertexFromGameObject(vgo);
                            //showGUI(2f);
                        }
                        m_edgeSelected = null;
                        _justeSelected = true;
                    }

                }
                //Changement de position du vertex s�lectionn�e quand on garde le bouton de souris appliqu�
                else if (PC.In.Click1Hold())
                {
                    RaycastHit vHit = new RaycastHit();
                    Vector2 v2;

                    if (m_vertexSelected != null && _justeSelected)
                    {
                        if (PC.In.Drag1(out v2))
                        {
                            Ray vRay = Camera.main.ScreenPointToRay(PC.In.GetCursorPos());
                            if (Physics.Raycast(vRay, out vHit, 1000, 1 << LayerMask.NameToLayer("grid")))
                            {
                                moveVertex(m_vertexSelected, vHit.point);

                                //On cache le menu lors du d�placement du Vertex
                                if (Time.time - hideGUITimer > 0.2f)
                                {
                                    hideGUI();
                                    Debug.Log("hiding Gui after dragging");
                                    m_uiRects = new List<Rect>();
                                }

                            }

                        }
                    }

                }

            }
            else
            {
                //Si la souris est sur le menu, on le maintien affich�
                if (Time.time - hideGUITimer <= 2f)
                {
                    hideGUITimer = Time.time;
                }
            }
        }
        //Si le mode edition n'est pas activ�, on quitte le configurateur si l'utilisateur clique en dehors du menu.
        else
        {
            if (PC.In.Click1Down())
            {
                if (PC.In.GetCursorPos().x <Screen.width-300)
                {
                    exitConfigurator(false);
                }
            }
        }
        /*if(m_vertexSelected!=null)
        {
            m_vertexSelected.gameObject.renderer.material.SetColor("_Color",SELECTED_COLOR);
        }*/
        /*if (m_vertexSelected != null)
        {
            //PVertex selected = m_vertexSelected;
            m_vertexSelected.gameObject.renderer.material.SetColor("_Color",SELECTED_COLOR);
        }
        else if (m_vertices.Count > 0)
        {
            PVertex selected = m_vertices.Last.Value;
            selected.gameObject.renderer.material.SetColor("_Color",SELECTED_COLOR);
        }*/
    }
Пример #14
0
 /// <summary>
 ///Sauvegarde l'�tat des ar�tes et des points.
 ///</summary>
 private void saveEdgesAndVertices()
 {
     m_verticesSaved = new LinkedList<PVertex>();
     m_edgesSaved = new List<PEdge>();
     Debug.Log("Vertices Saved :" + m_vertices.Count);
     foreach (PVertex v in m_vertices)
     {
         m_verticesSaved.AddLast(v);
     }
     foreach (PEdge e in m_edges)
     {
         PEdge newE = new PEdge();
         newE.v1 = e.v1;
         newE.v2 = e.v2;
         m_edgesSaved.Add(newE);
     }
 }