public void GenerateHeightmap(int posX, int posZ) { for (int x = 0; x < m_Width; ++x) { for (int z = 0; z < m_Width; ++z) { var height = GetTerrainHeight(posX + x, posZ + z); for (int y = 0; y < m_Height; ++y) { var blockType = GetBlockTypeForHeight(y, height); m_BlockData[x, y, z].BlockType = blockType; if (blockType != EBlockType.None) { m_BlockData[x, y, z].Health = m_BlockSettings.GetBlockInfo(blockType).Health; } } } } }
private void UpdateUVs() { var blockInfo = m_Settings.GetBlockInfo(m_BlockType); var uvs = new List <Vector2>(VERTEX_COUNT); uvs.AddRange(blockInfo.SideUVs); uvs.AddRange(blockInfo.SideUVs); uvs.AddRange(blockInfo.SideUVs); uvs.AddRange(blockInfo.SideUVs); uvs.AddRange(blockInfo.TopUVs); uvs.AddRange(blockInfo.BottomUVs); m_MeshFilter.mesh.uv = uvs.ToArray(); }