Ejemplo n.º 1
0
Archivo: World.cs Proyecto: Alword/Bost
 public BlockState this[Int3 location]
 {
     get {
         Int3 chunkSectionKey = location.GetChunk();
         Int2 chunkKey        = new Int2(chunkSectionKey.X, chunkSectionKey.Z);
         if (Chunks.ContainsKey(chunkKey))
         {
             ChunkColumn  chunk   = Chunks[chunkKey];
             ChunkSection section = chunk[chunkSectionKey.Y];
             if (section == null)
             {
                 return(new BlockState());
             }
             else
             {
                 Int3    bp = location.InChunkBlock();
                 BlockId id = section.GetBlock(bp.X, bp.Y, bp.Z);
                 return(GlobalPalette.GetState(id.StateId));
             }
         }
         else
         {
             return(new BlockState());
         }
     }
 }
Ejemplo n.º 2
0
        void CheckBlock(int x, int y, int z)
        {
            Vector3Int pos   = new Vector3Int(x, y, z);
            BlockType  block = c.GetBlock(x, y, z);

            if (block == BlockType.Air)
            {
                return;
            }

            Block data = BlockDictionary.Get(block);

            data.Generate(GetActiveMesh(data), pos, c);
        }