Beispiel #1
0
    IEnumerator Test()
    {
        yield return(new WaitForEndOfFrame());

        //yield return Ninja.JumpToUnity;
        //vertices = GetComponent<MeshFilter>().mesh.vertices;
        //yield return Ninja.JumpBack;
        curDistance = distance;

        int vIndex = 0;

        for (int i = 0; i < sizeX; i++)
        {
            for (int j = 0; j < sizeX; j++)
            {
                Quad q = quads[i, j];
                q.Calculate();

                int triangleIndex = vIndex;
                // copy vertices
                for (int k = 0; k < q.vertices.Length; k++)
                {
                    vertices[vIndex] = q.vertices[k];
                    vIndex++;
                }

                // set triangles
                //vertices[triangleIndex] = triangleIndex;
            }
        }

        yield return(Ninja.JumpToUnity);

        //GetComponent<MeshFilter>().mesh.Clear();
        GetComponent <MeshFilter>().sharedMesh.vertices = vertices;

        this.StartCoroutineAsync(Test());
    }