Пример #1
0
    IEnumerator ThreadedAssemble()
    {
        int task = ThreadRunner.CreateThread(new System.Threading.ParameterizedThreadStart(ThreadedSphere), (object)SphereDetail);

        ThreadRunner.StartThread(task);

        while (!ThreadRunner.isComplete(task))
        {
            yield return(null);
        }

        ThreadedSimpleMesh myNewMesh = (ThreadedSimpleMesh)ThreadRunner.FetchData(task);

        Mesh newMesh = myNewMesh.GenerateMesh();
        int  verts   = newMesh.vertexCount;

        if (SaveSphere)
        {
            SaveSphere = false;

            AssetDatabase.CreateAsset(newMesh, "Assets/Meshes/IcoSpheres/IcoSphere-D" + SphereDetail + "-v" + verts + ".asset");
        }

        mf.sharedMesh = newMesh;
    }
Пример #2
0
    public static int GetPath(Vector3 entry, Vector3 exit, float tolerance = 5f)
    {
        // main.StartCoroutine(main.FindPath(entry, exit, tolerance));

        NavPathRequest r = new NavPathRequest(entry, exit, tolerance);
        int            t = ThreadRunner.CreateThread(new ParameterizedThreadStart(main.ThreadFindPathObject), (object)r);

        Debug.Log("Created pathing thread #" + t);

        ThreadRunner.StartThread(t);
        return(t);
    }
Пример #3
0
    IEnumerator ThreadedAssemble()
    {
        if (mr == null)
        {
            mr = GetComponent <MeshRenderer>();
        }
        if (mr == null)
        {
            Debug.Log("BadScalingSphere: no MR"); yield break;
        }
        if (mf == null)
        {
            mf = GetComponent <MeshFilter>();
        }
        if (mf == null)
        {
            Debug.Log("BadScalingSphere: no MF"); yield break;
        }


        int task = ThreadRunner.CreateThread(new System.Threading.ParameterizedThreadStart(ThreadedSphere), (object)SphereDetail);

        ThreadRunner.StartThread(task);

        while (!ThreadRunner.isComplete(task))
        {
            yield return(null);
        }

        ThreadedSimpleMesh myNewMesh = (ThreadedSimpleMesh)ThreadRunner.FetchData(task);

        Mesh newMesh = myNewMesh.GenerateMesh();

        int poly = newMesh.triangles.GetLength(0) / 3;

        AssetDatabase.CreateAsset(newMesh, "Assets/Exported/ScalingSphere-" + SphereRadius + "m-" + poly + "v.asset");
        Debug.Log("[GENERATEPYRAMID] Exported mesh: /Assets/Exported/ScalingSphere-" + SphereRadius + "m-" + poly + "v.asset");

        mf.sharedMesh = newMesh;
    }