本文整理汇总了C#中App.simToDrawPos方法的典型用法代码示例。如果您正苦于以下问题:C# App.simToDrawPos方法的具体用法?C# App.simToDrawPos怎么用?C# App.simToDrawPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App.simToDrawPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
/// <remarks>call mesh.Clear() before calling this</remarks>
public void draw(List<MoveLine> moveLines, App app, long time, float depth)
{
List<Vector3> vertices = new List<Vector3>();
List<int> triangles = new List<int>();
// ISSUE #16: make width, fade interval, color customizable by mod
foreach (MoveLine moveLine in moveLines) {
if (moveLine.player == app.selPlayer && time - moveLine.time >= 0 && time - moveLine.time < 500) {
for (int i = 0; i < moveLine.vertices.Count; i += 2) {
Vector3 posStart = app.simToDrawPos (moveLine.vertices[i], depth);
Vector3 posEnd = app.simToDrawPos (moveLine.vertices[i + 1], depth);
if (posStart == posEnd) continue;
Vector3 offset = 2 * (1 - (time - moveLine.time) / 500f) * new Vector3(posStart.y - posEnd.y, posEnd.x - posStart.x, 0) / Vector3.Distance (posStart, posEnd);
vertices.Add (posStart - offset);
vertices.Add (posStart + offset);
vertices.Add (posEnd - offset);
vertices.Add (posEnd + offset);
triangles.Add (vertices.Count - 4);
triangles.Add (vertices.Count - 3);
triangles.Add (vertices.Count - 2);
triangles.Add (vertices.Count - 1);
triangles.Add (vertices.Count - 2);
triangles.Add (vertices.Count - 3);
}
}
}
if (vertices.Count > 0) {
mesh.vertices = vertices.ToArray ();
mesh.triangles = triangles.ToArray ();
mesh.uv = new Vector2[vertices.Count];
mesh.normals = new Vector3[vertices.Count];
}
}