Пример #1
0
 private void SpawnTestObjects()
 {
     Debug.Log("PerlinCityGenerator: Spawning test objects");
     foreach (GridFace face in polyGrid.GetFaces())
     {
         //GameObject test = GameObject.Instantiate(testObject, transform);
         //test.transform.position = face.GetPosition();
         foreach (Node vert in face.GetVertices())
         {
             GameObject test = GameObject.Instantiate(testObject, transform);
             test.transform.position = vert.GetPosition();
         }
     }
 }
Пример #2
0
    public void ShowGridProps()
    {
        EditorGUILayout.BeginVertical();

        showGridVertices = EditorGUILayout.Foldout(showGridVertices, "Vertices");
        if (showGridVertices)
        {
            vertScrollPos = EditorGUILayout.BeginScrollView(vertScrollPos);
            List <Node> verts = polyGrid.GetVertices();
            GUI.enabled = false;
            for (int i = 0; i < verts.Count; i++)
            {
                string str = "Vertex " + i;
                EditorGUILayout.Vector2Field(str, verts[i].GetPosition());

                EditorGUILayout.IntField("connections", verts[i].NumConnections());
            }
            GUI.enabled = true;
            EditorGUILayout.EndScrollView();
        }

        showGridFaces = EditorGUILayout.Foldout(showGridFaces, "Faces");
        if (showGridFaces)
        {
            faceScrollPos = EditorGUILayout.BeginScrollView(faceScrollPos);
            GUI.enabled   = false;
            List <GridFace> faces = polyGrid.GetFaces();
            for (int i = 0; i < faces.Count; i++)
            {
                string str = "Face " + i;
                EditorGUILayout.Vector2Field(str, faces[i].GetPosition());

                EditorGUILayout.IntField("vertices", faces[i].NumVertices());
            }
            GUI.enabled = true;
            EditorGUILayout.EndScrollView();
        }
        EditorGUILayout.EndHorizontal();
    }