// Update is called once per frame
        void Update()
        {
            // hax
            if (m_SelectedElement != null)
            {
                if (m_SelectedElement.GetComponent <SLO_Face>())
                {
                    SLO_Face face = m_SelectedElement.GetComponent <SLO_Face>();
                    m_UITxt_Tri.text =
                        "Face: #" + face.m_Index + "\n" +
                        "Edge 0 Length: " + (face.Edge0Length * 1000).ToString("###") + "\n" +
                        "Edge 01 Angle: " + face.Angle01.ToString("##.#") + "\n" +
                        "Edge 1 Length: " + (face.Edge1Length * 1000).ToString("###") + "\n" +
                        "Edge 12 Angle: " + face.Angle12.ToString("##.#") + "\n" +
                        "Edge 2 Length: " + (face.Edge2Length * 1000).ToString("###") + "\n" +
                        "Edge 20 Angle: " + face.Angle20.ToString("##.#") + "\n";
                }
                else if (m_SelectedElement.transform.parent.transform.parent.GetComponent <SLO_Edge>())
                {
                    SLO_Edge edge = m_SelectedElement.transform.parent.transform.parent.GetComponent <SLO_Edge>();
                    m_UITxt_Tri.text =
                        "Edge: #" + edge.m_Index + "\n" +
                        "Length: " + (edge.Length * 1000).ToString("###") + "\n" +
                        "Connected to Joiners: " + edge.m_Join0.Index + " - " + edge.m_Join1.Index;
                }
            }


            // Update GUI
            if (SelectedObj != null)
            {
                m_TextEdgeLength.text = "Edge Length: " + (SelectedObj.TotalEdgeLength * 1000f).ToString("##");
                m_TextAreaTotal.text  = "Area: " + (SelectedObj.TotalArea * 1000f).ToString("##");

                m_TextJointCount.text = "Joint count: " + SelectedObj.JointCount;
            }
        }
示例#2
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.C))
            {
                m_SelectedSLOObject = m_MeshConvertor.ConvertMesh(m_MeshFilterTest, true, true);
            }

            // Testing
            if (Input.GetKeyDown(KeyCode.Delete))
            {
                if (m_SelectedComponentType == ComponentType.Face)
                {
                    SLO_Face face = m_SelectedComponent.GetComponent <SLO_Face>();

                    m_SelectedSLOObject.Faces.Remove(face);

                    // TODO: Remove tabs?

                    Destroy(face.gameObject);

                    m_GUI.m_SelectedElement = null;
                }
                else if (m_SelectedComponentType == ComponentType.Edge)
                {
                    SLO_Edge edge = m_SelectedComponent.GetComponent <SLO_Edge>();

                    // Remove form list
                    m_SelectedSLOObject.Edges.Remove(edge);

                    edge.Delete();

                    // set gui back to null
                    m_GUI.m_SelectedElement = null;
                }
            }
        }