コード例 #1
0
ファイル: Chunk.cs プロジェクト: b4p3p/voxelengine
 internal void AddVoxelAt(Vector3 posVoxel, VoxelType voxelType)
 {
     if (voxels.ContainsKey(posVoxel))
         voxels[posVoxel] = new Voxel(this, voxelType);
     else
         voxels.Add(posVoxel, new Voxel(this, voxelType));
 }
コード例 #2
0
ファイル: VEngine.cs プロジェクト: b4p3p/voxelengine
        public void AddVoxelAt(Vector3 posVoxel, VoxelType type)
        {
            //converto la posizione del voxel nella posizione iniziale del chunk
            Vector3 posChunk = GetStartPosChunk(posVoxel);

            //verifico che il chunk esista
            //se non esiste lo creo
            Chunk chunk = null;
            if (chunks.ContainsKey(posChunk) == false)
            {
                chunk = Chunk.CreateChunkAt(posChunk, chunckContainer, ChunkSize);
                chunks.Add( posChunk, chunk );
            }

            chunk = chunks[posChunk];
            chunk.AddVoxelAt(posVoxel - posChunk, type);
        }
コード例 #3
0
ファイル: Voxel.cs プロジェクト: b4p3p/voxelengine
 public Voxel(Chunk chunk, VoxelType voxelType)
 {
     this.chunk = chunk;
     this.voxelType = voxelType;
 }