Exemple #1
0
        public static void SelectHandle(Handle h)
        {
            selectedHandles.Add(h);

            //LevelEditor.editorMode = LevelEditor.EditorMode.edit;

            Vector3[] vertices          = LevelPlacer.generatedLevel.moveArea.meshFilter.mesh.vertices;
            int[]     triangles         = LevelPlacer.generatedLevel.moveArea.meshFilter.mesh.triangles;
            Vector3[] newSelectionVerts = VertHelper.GetTriangleVerticiesByVertex(vertices, triangles, h.transform.position);
            print("seöectHandle " + newSelectionVerts.Length);

            foreach (Vector3 v in newSelectionVerts)
            {
                selectionTriangleVerts.Add(v);
            }
            SoundManager.PlayLightWobble();

            // there are at lest three verticies in total left and we plan to delete a vertex that is component of only one triangle
            if (vertices.Length > 3 && selectionTriangleVerts.Count <= 3)
            {
                UILevelEditor.DeleteShow(true);
            }
            else
            {
                UILevelEditor.DeleteShow(false);
            }
        }
Exemple #2
0
        public static void DeselectHandle(Handle h)
        {
            selectedHandles.Remove(h);
            SoundManager.PlayLightWobble(0.6F);

            Vector3[] vertices            = LevelPlacer.generatedLevel.moveArea.meshFilter.mesh.vertices;
            int[]     triangles           = LevelPlacer.generatedLevel.moveArea.meshFilter.mesh.triangles;
            Vector3[] newDeselectionVerts = VertHelper.GetTriangleVerticiesByVertex(vertices, triangles, h.transform.position);

            foreach (Vector3 v in newDeselectionVerts)
            {
                selectionTriangleVerts.Remove(v);
            }

            if (selectedHandles.Count == 0)
            {
                selectionTriangleVerts.Clear();
                UILevelEditor.DeleteShow(false);
            }
            else if (vertices.Length > 3 && selectionTriangleVerts.Count <= 3)
            {
                UILevelEditor.DeleteShow(true);
            }
        }