Пример #1
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);
        }
Пример #2
0
    public void AddBlock(Block block)
    {
        Vector3 centeredCubePosition = block.Position;

        ChunkDictionary.Add(block.Position, block.Position);

        (IChunk chunk, GameObject parent, bool hasCreatedNewChunk) = GenerateOrGetChunkGameObject(centeredCubePosition);
        chunk.AddBlock(block);


        if (!hasCreatedNewChunk)
        {
            ModifyMesh.Combine(block, parent);
        }
        else
        {
            ModifyMesh.CombineForAll(parent);
        }
    }