本文整理汇总了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();
}
示例2: SetNewPath
public void SetNewPath(Vector2[] path)
{
Path = path.ToList();
ConvertToPath();
currentPoint = 0;
}