예제 #1
0
        /// <summary>
        /// Applies an edit batch to this world, remeshing chunks as needed.
        /// </summary>
        /// <param name="editBatch">The edit batch to apply.</param>
        public void SetBlocks(EditBatch editBatch)
        {
            foreach (var block in editBatch())
            {
                if (block.BlockID >= m_BlockList.BlockCount)
                {
                    throw new System.ArgumentOutOfRangeException("editBatch", $"Invalid block type '{block.BlockID}'!");
                }

                m_WorldContainer.SetBlock(block.Position, block.BlockID);
            }

            m_WorldContainer.RemeshDirtyChunks();
        }
예제 #2
0
 /// <summary>
 /// Creates a new set-blocks task.
 /// </summary>
 /// <param name="editBatch">The iterator for blocks to place.</param>
 internal SetBlocksTask(EditBatch editBatch)
 {
     m_EditBatch = editBatch;
 }
예제 #3
0
 /// <summary>
 /// Applies an edit batch to this world, remeshing chunks as needed.
 /// </summary>
 /// <param name="editBatch">The edit batch to apply.</param>
 internal void SetBlocks(EditBatch editBatch) => m_ServerThread.RunTask(new SetBlocksTask(editBatch));