本文整理汇总了C#中MapData.GetEdgeHeights方法的典型用法代码示例。如果您正苦于以下问题:C# MapData.GetEdgeHeights方法的具体用法?C# MapData.GetEdgeHeights怎么用?C# MapData.GetEdgeHeights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapData
的用法示例。
在下文中一共展示了MapData.GetEdgeHeights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSubMeshes
GameObject[] CreateSubMeshes(MapData data, int patchSize, float size, float yOffset, out MeshCollider[] clds)
{
int xCount, zCount;
if (data.xCount < patchSize)
{
this.patchSize = data.xCount;
xCount = 1;
zCount = 1;
}
else
{
this.patchSize = patchSize;
xCount = data.xCount / patchSize;
zCount = data.zCount / patchSize;
}
int count = xCount * zCount;
GameObject[] result = new GameObject[count];
clds = new MeshCollider[count];
int i = 0;
Vector3 meshOffset = GetOffset() + new Vector3(0, yOffset, 0);
for (int z = 0; z < zCount; z++)
{
for (int x = 0; x < xCount; x++)
{
Mesh subMesh = CreateSubMesh(data, x * patchSize, z * patchSize, patchSize, patchSize, size, meshOffset);
GameObject obj = new GameObject();
obj.name = string.Format("subMesh_{0}_{1}", x, z);
MeshFilter meshFilter = obj.AddComponent<MeshFilter>();
meshFilter.mesh = subMesh;
meshFilter.sharedMesh.UploadMeshData(false);
MeshRenderer rd = obj.AddComponent<MeshRenderer>();
rd.material = lineMaterial;
GameObject cldObj = new GameObject(obj.name + "_cld");
cldObj.transform.parent = obj.transform;
MeshCollider cld = cldObj.AddComponent<MeshCollider>();
Mesh mesh = GridmeshCreator.CreateGridMesh(patchSize, patchSize, new Vector3(x * patchSize, 0, z * patchSize) + GetOffset(), patchSize, patchSize);
GridmeshCreator.SetHeight(mesh, data.GetEdgeHeights(x * patchSize, z * patchSize, patchSize, patchSize));
cld.sharedMesh = mesh;
cld.sharedMesh.UploadMeshData(false);
clds[i] = cld;
result[i] = obj;
i++;
}
}
return result;
}