Exemplo n.º 1
0
        public void LoadChunks(List <ChunkFile> Chunks, ChunkManager Manager)
        {
            if (Chunks.Count == 0)
            {
                throw new Exception("Game file corrupt. It has no chunk files.");
            }

            var maxChunkX = Chunks.Max(c => c.ID.X) + 1;
            var maxChunkY = Chunks.Max(c => c.ID.Y) + 1;
            var maxChunkZ = Chunks.Max(c => c.ID.Z) + 1;

            var minChunkX = Chunks.Min(c => c.ID.X);
            var minChunkY = Chunks.Min(c => c.ID.Y);
            var minChunkZ = Chunks.Min(c => c.ID.Z);

            MapOrigin     = new Point3(minChunkX, minChunkY, minChunkZ);
            MapDimensions = new Point3(maxChunkX - minChunkX, maxChunkY - minChunkY, maxChunkZ - minChunkZ);

            ChunkMap = new VoxelChunk[MapDimensions.X * MapDimensions.Y * MapDimensions.Z];

            foreach (VoxelChunk chunk in Chunks.Select(file => file.ToChunk(Manager)))
            {
                AddChunk(chunk);
            }

            Manager.UpdateBounds();
        }
Exemplo n.º 2
0
 public void LoadFromFile(GameFile gameFile, ref string loadingMessage)
 {
     foreach (VoxelChunk chunk in gameFile.Data.ChunkData.Select(file => file.ToChunk(chunkManager)))
     {
         AddChunk(chunk);
     }
     chunkManager.UpdateBounds();
     chunkManager.UpdateRebuildList();
     chunkManager.CreateGraphics(ref loadingMessage, this);
 }
Exemplo n.º 3
0
 public void LoadFromFile(GameFile gameFile, Action <String> SetLoadingMessage)
 {
     foreach (VoxelChunk chunk in gameFile.Data.ChunkData.Select(file => file.ToChunk(chunkManager)))
     {
         AddChunk(chunk);
     }
     RecomputeNeighbors();
     chunkManager.UpdateBounds();
     chunkManager.UpdateRebuildList();
     chunkManager.CreateGraphics(SetLoadingMessage, this);
 }
Exemplo n.º 4
0
        public void LoadFromFile(SaveGame gameFile, Action <String> SetLoadingMessage)
        {
            var maxChunkX = gameFile.ChunkData.Max(c => c.ID.X) + 1;
            var maxChunkZ = gameFile.ChunkData.Max(c => c.ID.Z) + 1;

            ChunkMapMinX   = gameFile.ChunkData.Min(c => c.ID.X);
            ChunkMapMinZ   = gameFile.ChunkData.Min(c => c.ID.Z);
            ChunkMapWidth  = maxChunkX - ChunkMapMinX;
            ChunkMapHeight = maxChunkZ - ChunkMapMinZ;

            ChunkMap = new VoxelChunk[ChunkMapWidth * ChunkMapHeight];

            foreach (VoxelChunk chunk in gameFile.ChunkData.Select(file => file.ToChunk(chunkManager)))
            {
                AddChunk(chunk);
            }

            chunkManager.UpdateBounds();
        }
Exemplo n.º 5
0
        public void LoadFromFile(ChunkManager Manager, SaveGame gameFile, Action <String> SetLoadingMessage)
        {
            if (gameFile.ChunkData.Count == 0)
            {
                throw new Exception("Game file corrupt. It has no chunk files.");
            }
            var maxChunkX = gameFile.ChunkData.Max(c => c.ID.X) + 1;
            var maxChunkZ = gameFile.ChunkData.Max(c => c.ID.Z) + 1;

            ChunkMapMinX   = gameFile.ChunkData.Min(c => c.ID.X);
            ChunkMapMinZ   = gameFile.ChunkData.Min(c => c.ID.Z);
            ChunkMapWidth  = maxChunkX - ChunkMapMinX;
            ChunkMapHeight = maxChunkZ - ChunkMapMinZ;

            ChunkMap = new VoxelChunk[ChunkMapWidth * ChunkMapHeight];

            foreach (VoxelChunk chunk in gameFile.ChunkData.Select(file => file.ToChunk(Manager)))
            {
                AddChunk(chunk);
            }

            Manager.UpdateBounds();
        }