Example #1
0
        /// <summary>
        /// Creates a new Unity world builder object.
        /// </summary>
        /// <param name="transform">The transform to add chunk gameobjects to.</param>
        /// <param name="blockList">The block list to read from.</param>
        /// <param name="chunkSize">The chunk size of the world.</param>
        /// <param name="id">The ID value of the world.</param>
        internal UnityWorldBuilder(Transform transform, BlockListManager blockList, WorldProperties worldProperties)
        {
            ChunkSize = worldProperties.ChunkSize;

            var container = new WorldContainer(worldProperties);

            container.EventQueue.OnWorldEvent += OnBlockWorldEvent;

            {
                // TODO TEMP CODE REMOVE THIS
                container.BlockList.UpdateBlockType(CreateBlock(2, "Grass", 0));
                container.BlockList.UpdateBlockType(CreateBlock(3, "SideDirt", 1));
                container.BlockList.UpdateBlockType(CreateBlock(4, "Dirt", 2));
            }

            m_ServerThread = new ServerThread(container);

            m_ChunkCreator     = new ChunkCreator(transform, ChunkSize);
            m_ChunkMeshBuilder = new ChunkMeshBuilder(blockList);
        }
Example #2
0
 /// <summary>
 /// Creates a new chunk mesh builder.
 /// </summary>
 /// <param name="blockList">The block list to read from.</param>
 internal ChunkMeshBuilder(BlockListManager blockList)
 {
     m_BlockList = blockList;
     m_ProcMesh  = new ProcMesh();
 }