Exemplo n.º 1
0
    void OnCreateColliderForChunk(TerrainChunk chunk)
    {
        // TODO: Create a function that returns these values
        chunkCollidersMade++;

        totNormalX     += chunk.averageXNormal;
        totNormalY     += chunk.averageYNormal;
        totNormalZ     += chunk.averageZNormal;
        totValidSlope  += chunk.averageValidSlope;
        totWaterAmount += chunk.averageWaterAmount;

        if (isGeneratorTrainer)
        {
            trainerChunksGenerated = chunkCollidersMade >= genAgent.GetMinimumChunks();
            if (trainerChunksGenerated)
            {
                genAgent.OnGenerationComplete();
            }
        }

        if (!isGeneratorTrainer)
        {
            chunk.CreateTrees();
        }

        if (!playerPlayScript.thirdPersonPlayer && !isGeneratorTrainer)
        {
            // Update the surface because colliders are created for volume modifiers now
            navMeshSurface.BuildNavMesh();
        }
    }