Esempio n. 1
0
    void LateUpdate()
    {
        // check how many chunks loaded and queue the ones that couldnt up for generation
        chunksLoaded += Serialization.CheckNewLoaded(chunkGenQueue);

        Serialization.FreeSavedChunks(world.chunkPool);

        UnityEngine.Profiling.Profiler.BeginSample("Update Chunks");
        if (updateChunks)
        {
            UpdateChunks();
        }
        UnityEngine.Profiling.Profiler.EndSample();

        JobHandle.ScheduleBatchedJobs();

        Vector3i pbp = WorldUtils.GetBlockPos(transform.position);
        Vector3i pcp = WorldUtils.GetChunkPosFromBlockPos(pbp.x, pbp.y, pbp.z);

        if (drawDebug)
        {
            text.gameObject.SetActive(true);
            text.text = string.Format(
                "block x:{0} y:{1} z:{2}\n" +
                "chunk x:{3} y:{4} z:{5}\n" +
                "Generat: {6}/{7}\n" +
                "Structr: {8}/{9}\n" +
                "Meshing: {10}/{11}\n" +
                "Light  : {12}/{13}\n" +
                "SLight : {14}/{15}\n" +
                "Free/C : {16}/{17}\n" +
                "Chunks:  {18}\n" +
                "Loaded:  {19}\n" +
                "Greedy:  {20}\n" +
                "v3Pool:  {21}/{22}\n" +
                "intPool: {23}/{24}\n",
                pbp.x, pbp.y, pbp.z, pcp.x, pcp.y, pcp.z,
                JobController.genJobFinished, JobController.genJobScheduled,
                JobController.structureJobFinished, JobController.structureJobScheduled,
                JobController.meshJobFinished, JobController.meshJobScheduled,
                JobController.lightJobFinished, JobController.lightJobScheduled,
                JobController.sunlightJobFinished, JobController.sunlightJobScheduled,
                world.chunkPool.CountFree(), world.chunkPool.Count(),
                world.chunks.Count, chunksLoaded, Chunk.beGreedy,
                Pools.v3N.CountFree(), Pools.v3N.Count(),
                Pools.intN.CountFree(), Pools.intN.Count()
                );
        }
        else
        {
            text.gameObject.SetActive(false);
        }
    }