本文整理汇总了C#中System.Collections.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.SelectMany方法的具体用法?C# System.Collections.SelectMany怎么用?C# System.Collections.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections
的用法示例。
在下文中一共展示了System.Collections.SelectMany方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start2
public void Start2()
{
if (mf == null)
mf = GetComponent<MeshFilter>();
if (meshList.Count > 0)
{
var list = new List<CombineInstance>();
var r = mf.GetComponent<MeshRenderer>();
var enumerable = new[] { mf.renderer }.Concat(meshList);
r.sharedMaterials = enumerable.SelectMany(a => a.sharedMaterials).ToArray();
foreach (var a in enumerable)
{
var sharedMesh = a.GetComponent<MeshFilter>().sharedMesh;
for (int i = 0; i < sharedMesh.subMeshCount; i++)
{
var ci = new CombineInstance();
ci.transform = tr.worldToLocalMatrix * a.transform.localToWorldMatrix;
ci.mesh = sharedMesh;
ci.subMeshIndex = i;
list.Add(ci);
}
}
mf.mesh.CombineMeshes(list.ToArray(), false);
foreach (var a in meshList)
Destroy(a.gameObject);
}
lossyScale = mf.transform.lossyScale;
elements.Clear();
lab = new Dictionary<int, List<Tr>>();
vertices = mf.mesh.vertices;
oldVertices = (Vector3[])vertices.Clone();
normals = mf.mesh.normals;
tangents = mf.mesh.tangents;
uvs = mf.mesh.uv;
for (int x = 0; x < mf.mesh.subMeshCount; x++)
{
var trs = mf.mesh.GetIndices(x);
for (int i = 0; i < trs.Length; i += 3)
{
var tr = new Tr() { ind = new[] { trs[i], trs[i + 1], trs[i + 2] }, pointers = new[] { i, i + 1, i + 2 }, group = x };
flat.Add(tr);
for (int j = 0; j < 3; j++)
{
List<Tr> lt;
if (!lab.TryGetValue(trs[i + j], out lt))
lab[trs[i + j]] = lt = new List<Tr>();
lt.Add(tr);
}
}
}
foreach (Tr t in flat)
{
if (!t.went)
{
Element element = new Element();
element.MeshTest = this;
elements.Add(element);
var color32 = new Color32((byte)(Random.value * 255), (byte)(Random.value * 255), (byte)(Random.value * 255), 255);
Go(t, color32, element, 0);
}
}
}