Exemple #1
0
    private void DrawPointGizmos()
    {
        if (fan.Length <= 0f)
        {
            return;
        }
        var col = color;

        if (pointObj != null && fan.ContainPoint(pointObj.point))
        {
            col = Color.red;
        }
        else if (rectObj != null && fan.IntersectWith(rectObj.rect))
        {
            col = Color.red;
        }
        else if (circleObj != null && fan.IntersectWith(circleObj.circle))
        {
            col = Color.red;
        }



        GizmosUtil.DrawFan(fan, col, mesh);
    }
    private void OnDrawGizmos()
    {
        bool isRectInersctWithCircle  = m_circle.IntersectWith(m_rect);
        bool isFanIntersectWithCircle = m_fan.IntersectWith(m_circle);
        bool isFanIntersectWithRect   = m_fan.IntersectWith(m_rect);


        Color rectColor;

        if (isRectInersctWithCircle)
        {
            rectColor = m_intersectCol;
        }
        else
        {
            rectColor = m_colors[0];
        }
        GizmosUtils.DrawRectSolid(m_rect, rectColor);
        GizmosUtils.DrawRect(m_rect.Extand(m_circle.m_radius, m_circle.m_radius), rectColor);

        Color circleColor;

        if (isRectInersctWithCircle || isFanIntersectWithCircle)
        {
            circleColor = m_intersectCol;
        }
        else
        {
            circleColor = m_colors[1];
        }
        GizmosUtils.DrawCircle(m_circle, circleColor);


        Color fanColor;

        if (isFanIntersectWithCircle || isFanIntersectWithRect)
        {
            fanColor = m_intersectCol;
        }
        else
        {
            fanColor = m_colors[2];
        }
        GizmosUtils.DrawFan(m_fan, fanColor);


        if (m_circle.ContainPoint(m_point) || m_rect.ContainPoint(m_point) || m_fan.ContainPoint(m_point))
        {
            Gizmos.color = m_intersectCol;
        }
        else
        {
            Gizmos.color = m_colors[3];
        }
        GizmosUtils.DrawPoint(m_point);
    }