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


C# Vector2.ToList方法代码示例

本文整理汇总了C#中UnityEngine.Vector2.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.ToList方法的具体用法?C# Vector2.ToList怎么用?C# Vector2.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Vector2的用法示例。


在下文中一共展示了Vector2.ToList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetIntersectedPolygon

        /// <summary>
        /// Calculates the intersection between a polygon and a line.
        /// </summary>
        /// <param name="subjectPoly">An Array of polygon points.</param>
        /// <param name="linePoints">Two points that form a line.</param>
        /// <returns>Returns an Array of polygon points.</returns>
        public static Vector2[] GetIntersectedPolygon(Vector2[] subjectPoly, Vector2[] linePoints, out bool intersecting)
        {
            List<Vector2> outputList = subjectPoly.ToList();
            intersecting = true;

            Edge clipEdge = new Edge(linePoints[0], linePoints[1]);

            List<Vector2> inputList = outputList.ToList();
            outputList.Clear();

            Vector2 lastVert = inputList[inputList.Count - 1];
            int len = inputList.Count;

            for (int i = 0; i < len; i++)
            {
                Vector2 vert = inputList[i];

                if (IsInside(clipEdge, vert))
                {
                    if (!IsInside(clipEdge, lastVert))
                    {
                        Vector2? point = GetIntersect(lastVert, vert, clipEdge.From, clipEdge.To);
                        if (point != null)
                        {
                            outputList.Add(point.Value);
                        }
                    }

                    outputList.Add(vert);
                }
                else if (IsInside(clipEdge, lastVert))
                {
                    Vector2? point = GetIntersect(lastVert, vert, clipEdge.From, clipEdge.To);
                    if (point != null)
                    {
                        outputList.Add(point.Value);
                    }
                }

                lastVert = vert;
            }

            if (outputList.Count == 0)
            {
                intersecting = false;
            }
            //	Exit Function
            return outputList.ToArray();
        }
开发者ID:Bakiet,项目名称:UnityZombieCross,代码行数:55,代码来源:Water2D_PolygonClipping.cs

示例2: SetNewPath

 public void SetNewPath(Vector2[] path)
 {
     Path = path.ToList();
       ConvertToPath();
       currentPoint = 0;
 }
开发者ID:musicm122,项目名称:The-Depths-of-H-E-double-hockey-stick,代码行数:6,代码来源:FollowPath.cs


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