Exemplo n.º 1
0
    static public void DrawFill(ShapeFill shape)
    {
        Vector2  pointInWorld;
        Vector2D pointInWorld2D = Vector2D.Zero();

        foreach (Vector2D point in shape.pointsIn)
        {
            pointInWorld = shape.transform.TransformPoint(point.ToVector2());

            pointInWorld2D.x = pointInWorld.x;
            pointInWorld2D.y = pointInWorld.y;

            if (ShapeObject.PointInShapes(pointInWorld2D) == false)
            {
                ShapeDraw.Draw(pointInWorld, shape.transform);
            }
        }
    }
Exemplo n.º 2
0
            public override void Draw()
            {
                InitDraw();

                if (m_PrimaryShape != null)
                {
                    m_PrimaryShape.Draw();
                }

                for (int i = 0; i < m_Points.Length; i++)
                {
                    Handles.DrawLine(m_Points[i], m_SecondaryPoints[i], c_LineThickness);
                    // Makes the arrow heads a lot nicer for close casts
                    var cone = Mathf.Lerp(0f, c_ConeSize, m_Distance / 20f);
                    cone = Mathf.Clamp(cone, 0.1f, c_ConeSize);
                    Handles.ConeHandleCap(0, m_ConePoints[i], m_LookRotation, cone, EventType.Repaint);
                }

                if (m_IsFiniteDistance && m_SecondaryShape != null)
                {
                    m_SecondaryShape.Draw();
                }
            }
Exemplo n.º 3
0
    public static void DrawMatch(ShapeObject shapeA, ShapeObject shapeB)
    {
        Vector2   pointInWorld;
        Vector2D  pointInWorld2D = Vector2D.Zero();
        Polygon2D polyInWorld;

        foreach (Vector2D point in shapeA.pointsIn)
        {
            pointInWorld = shapeA.transform.TransformPoint(point.ToVector2());

            pointInWorld2D.x = pointInWorld.x;
            pointInWorld2D.y = pointInWorld.y;

            polyInWorld = shapeB.GetWorldPolygon();

            if (polyInWorld.PointInPoly(pointInWorld2D))
            {
                ShapeDraw.Draw(pointInWorld, shapeA.transform);
            }
        }

        foreach (Vector2D point in shapeB.pointsIn)
        {
            pointInWorld = shapeB.transform.TransformPoint(point.ToVector2());

            pointInWorld2D.x = pointInWorld.x;
            pointInWorld2D.y = pointInWorld.y;

            polyInWorld = shapeA.GetWorldPolygon();

            if (polyInWorld.PointInPoly(pointInWorld2D))
            {
                ShapeDraw.Draw(pointInWorld, shapeB.transform);
            }
        }
    }