Esempio n. 1
0
        public ScBlock GetBlock(int x, int y, int z)
        {
            int blockX = x % 16;
            int blockZ = z % 16;
            int chunkX = (x - blockX) / 16;
            int chunkZ = (z - blockZ) / 16;

            ScChunk localChunk = ChunkDictionary
                                 .Where(localPair =>
                                        localPair.Key.ChunkX == chunkX &&
                                        localPair.Key.ChunkZ == chunkZ)
                                 .SingleOrDefault()
                                 .Value;

            if (localChunk == null)
            {
                throw new ArgumentException("Chunk not found.");
            }

            ////ScChunkPosition position = new ScChunkPosition(chunkX, chunkZ);
            ////if (!ChunkDictionary.ContainsKey(position))
            ////    throw new ArgumentException("Chunk not found.");
            ////ScChunk chunk = ChunkDictionary[position];
            ////ScBlock block = chunk.GetBlockInChunk(blockX, y, blockZ);
            //return block;

            return(null);
        }
Esempio n. 2
0
        public void AddChunk(ScChunkPosition argChunkPosition, ScChunk chunk)
        {
            ChunkDictionary.Add(argChunkPosition, chunk);

            //if (_minX == 0)
            //    _minX = chunk.ChunkX;

            //if (_minZ == 0)
            //    _minZ = chunk.ChunkZ;
            //_minX = Math.Min(chunk.ChunkX, _minX);
            //_minZ = Math.Min(chunk.ChunkZ, _minZ);
            //_maxX = Math.Max(chunk.ChunkX, _maxX);
            //_maxZ = Math.Max(chunk.ChunkZ, _maxZ);
        }