UnityEditor.PolygonEditor.GetPointCount C# (CSharp) Method

GetPointCount() private method

private GetPointCount ( int pathIndex ) : int
pathIndex int
return int
        public static extern int GetPointCount(int pathIndex);
        public static void InsertPoint(int pathIndex, int pointIndex, Vector2 value)

Usage Example

示例#1
0
        private void DrawPolygonCollider(Transform transform)
        {
            // Fetch the collider offset.
            var colliderOffset = m_ActiveCollider.offset;

            int pathCount = PolygonEditor.GetPathCount();

            for (int pathIndex = 0; pathIndex < pathCount; ++pathIndex)
            {
                int pointCount = PolygonEditor.GetPointCount(pathIndex);

                // Draw the points.
                for (int i = 0, j = pointCount - 1; i < pointCount; j = i++)
                {
                    Vector2 p0;
                    Vector2 p1;
                    PolygonEditor.GetPoint(pathIndex, i, out p0);
                    PolygonEditor.GetPoint(pathIndex, j, out p1);
                    p0 += colliderOffset;
                    p1 += colliderOffset;

                    Vector3 worldPosV0 = transform.TransformPoint(p0);
                    Vector3 worldPosV1 = transform.TransformPoint(p1);
                    worldPosV0.z = worldPosV1.z = transform.position.z;

                    Handles.color = Color.green;
                    Handles.DrawAAPolyLine(1.0f, new Vector3[] { worldPosV0, worldPosV1 });
                }
            }
        }
All Usage Examples Of UnityEditor.PolygonEditor::GetPointCount