コード例 #1
0
    private bool ContainsAllPointsOf(PolygonPen polygonPen, bool useBuffer)
    {
        Transform[] points = polygonPen.points;

        if (useBuffer)
        {
            foreach (Transform point in points)
            {
                if (!m_registredPolygonPenPointsBuffer.Contains(point))
                {
                    return(false);
                }
                else
                {
                    m_registredPolygonPenPointsBuffer.Remove(point);
                }
            }
        }
        else
        {
            foreach (Transform point in points)
            {
                if (!m_registredPolygonPenPoints.Contains(point))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
コード例 #2
0
    private bool ContainsAnyPointOf(PolygonPen polygonPen)
    {
        Transform[] points = polygonPen.points;
        foreach (Transform point in points)
        {
            if (m_registredPolygonPenPoints.Contains(point))
            {
                return(true);
            }
        }

        return(false);
    }
コード例 #3
0
    private void OnTriggerExit(Collider other)
    {
        PolygonPen polygonPen = other.GetComponentInParent <PolygonPen>();

        if (polygonPen)
        {
            m_registredPolygonPenPoints.Remove(other.transform);
            if (!ContainsAnyPointOf(polygonPen))
            {
                m_registredPolygonPens.Remove(polygonPen);
                m_registredPolygonPensLastPosition.Remove(polygonPen);
            }
        }
        else
        {
            PenEdge penEdge = other.GetComponent <PenEdge>();
            if (penEdge)
            {
                m_currentPenEdges.Remove(penEdge);
                m_penLastPositions.Remove(penEdge);
            }
        }
    }
コード例 #4
0
    private void OnTriggerEnter(Collider other)
    {
        PolygonPen polygonPen = other.GetComponentInParent <PolygonPen>();

        if (polygonPen)
        {
            m_registredPolygonPenPoints.Add(other.transform);
            if (!m_registredPolygonPens.Contains(polygonPen))
            {
                m_registredPolygonPens.Add(polygonPen);
                m_registredPolygonPensLastPosition.Add(polygonPen, polygonPen.transform.position);
            }
        }
        else
        {
            PenEdge penEdge = other.GetComponent <PenEdge>();
            if (penEdge)
            {
                m_currentPenEdges.Add(penEdge);
                m_penLastPositions.Add(penEdge, WorldPositionToBoardPosition(penEdge.transform.position));
            }
        }
    }