Esempio n. 1
0
    public void StartUp(VoxelMap map)
    {
        voxelMesh            = FindObjectOfType <VoxelMesh>();
        terrainNoise         = FindObjectOfType <TerrainNoise>();
        terrainMap           = FindObjectOfType <TerrainMap>();
        chunkCollider        = FindObjectOfType <ChunkCollider>();
        chunkObjectSpawner   = FindObjectOfType <ChunkObjectSpawner>();
        chunkSaveLoadManager = FindObjectOfType <ChunkSaveLoadManager>();
        playerRb             = FindObjectOfType <PlayerController>().GetComponent <Rigidbody2D>();

        voxelMap = map;

        terrainNoise.seed = voxelMap.worldScriptableObject.seed;
        terrainNoise.StartUp(voxelMap.voxelResolution, voxelMap.chunkResolution);
        voxelMesh.StartUp(voxelMap.voxelResolution, voxelMap.chunkResolution, voxelMap.viewDistance, useColliders, colliderRadius);

        InvokeRepeating(nameof(UpdateMap), 0.0f, terrainMap.updateInterval);
    }