当前位置: 首页>>代码示例>>C#>>正文


C# App.simToDrawPos方法代码示例

本文整理汇总了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];
     }
 }
开发者ID:ad510,项目名称:plausible-deniability,代码行数:33,代码来源:App.cs


注:本文中的App.simToDrawPos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。