Ejemplo n.º 1
0
    public static void InitializeWorld(WorldLoader _worldLoader)
    {
        chunks      = new Dictionary <int, int, Chunk>();
        worldLoader = _worldLoader;

        // Load saved chunks
        if (!System.IO.File.Exists(Application.dataPath + "/Saves/WORLDSAVE02.06.2021.bingus"))
        {
            return;
        }
        ChunkData[] worldChunkData = WorldSaver.LoadWorld(Application.dataPath + "/Saves/WORLDSAVE02.06.2021.bingus");
        foreach (ChunkData chunkData in worldChunkData)
        {
            int x = chunkData.x;
            int y = chunkData.y;
            chunks[x, y] = GenerateChunkFromData(chunkData);
            worldLoader.InstantiateChunk(x, y);
        }
    }