示例#1
0
        public BlockLocation(SectionInWorld SecInWorld, BlockInSection BlkInSec, IWorld _World)
        {
            //Get Section Location
            m_SecInWorld = SecInWorld;
            //Get Block Location
            m_BlkInSection = BlkInSec;
            //Get Chunk Location
            m_ChunkInWorld = m_SecInWorld.ToChunkInWorld(_World);
            //Get Block Location In World
            m_BlkInWorld = new BlockInWorld(m_SecInWorld, m_BlkInSection, _World);

            //Get Chunk
            m_Chunk = _World.Entity.GetChunk(m_ChunkInWorld);
            if (m_Chunk == null)
            {
                m_Section = null; m_Block = null; return;
            }

            //Get Section
            m_Section = m_Chunk.GetSection(m_SecInWorld.ToSectionInChunk());
            if (m_Section == null)
            {
                m_Block = null;; return;
            }

            //Get Block
            m_Block = m_Section.Voxel.GetBlock(m_BlkInSection);
        }
示例#2
0
        public void Update(Vector3 Coord, IWorld _World)
        {
            //Get Chunk Location
            m_ChunkInWorld = new ChunkInWorld(Coord, _World);
            //Get Section Location
            m_SecInWorld = new SectionInWorld(Coord, _World);
            //Get Block Location
            m_BlkInSection = new BlockInSection(Coord, _World);
            //Get Block Location In World
            m_BlkInWorld = new BlockInWorld(m_SecInWorld, m_BlkInSection, _World);

            //Get Chunk
            m_Chunk = _World.Entity.GetChunk(m_ChunkInWorld);
            if (m_Chunk == null)
            {
                m_Section = null; m_Block = null; return;
            }

            //Get Section
            m_Section = m_Chunk.GetSection(m_SecInWorld.ToSectionInChunk());
            if (m_Section == null)
            {
                m_Block = null;; return;
            }

            //Get Block
            m_Block = m_Section.Voxel.GetBlock(m_BlkInSection);
        }
示例#3
0
        public BlockLocation Offset_Blk(Vector3Int offset, IWorld _world)
        {
            //get offset block
            BlockInSection BlkInSec   = m_BlkInSection.Offset(offset, _world, out Vector3Int SecOffset);
            SectionInWorld SecInWorld = m_SecInWorld.Offset(SecOffset);

            return(new BlockLocation(SecInWorld, BlkInSec, _world));
        }
示例#4
0
 public BlockInWorld(SectionInWorld SecInWorld, BlockInSection blockInSec, IWorld _World)
 {
     m_Value = new Vector3Int(
         SecInWorld.x * _World.Section_Width + blockInSec.x,
         SecInWorld.y * _World.Section_Height + blockInSec.y,
         SecInWorld.z * _World.Section_Depth + blockInSec.z);
     m_Bound = new Bounds();
     m_Bound.SetMinMax(m_Value, m_Value + Vector3Int.one);
 }