Exemple #1
0
    public zCollisionPath(GLEED2D.PathItem path)
    {
        //  m_localPoints = path.LocalPoints;
        m_worldPoints = path.WorldPoints;
        m_lineWidth = path.LineWidth;
        m_lineColor = path.LineColor;
        m_isPolygon = path.IsPolygon;   //TODO handle this thing!

        m_normals = new Vector2[m_worldPoints.Length - 1];
        m_midpoints = new Vector2[m_worldPoints.Length - 1];

        float leftMoast;
        float rightMost;
        float topMost;
        float bottomMost;

        leftMoast = rightMost = m_worldPoints[0].X;
        topMost = bottomMost = m_worldPoints[0].Y;

        for (int i = 0; i < m_worldPoints.Length - 1; ++i)
        {
            Vector2 line = m_worldPoints[i + 1] - m_worldPoints[i];

            m_midpoints[i] = (line / 2.0f) + m_worldPoints[i];
            m_normals[i].X = line.Y;
            m_normals[i].Y = -line.X;
            m_normals[i].Normalize();

            //Check against bounding coords

            //Since we initialized to location 0 we use location i+1 to ensure we also check the last points in the line
            if (m_worldPoints[i + 1].X < leftMoast)
                leftMoast = m_worldPoints[i + 1].X;
            else if (m_worldPoints[i + 1].X > rightMost)
                rightMost = m_worldPoints[i + 1].X;

            if (m_worldPoints[i + 1].Y < topMost)
                topMost = m_worldPoints[i + 1].Y;
            else if (m_worldPoints[i + 1].Y > bottomMost)
                bottomMost = m_worldPoints[i + 1].Y;
        }

        //Floor the top left coord and ciel the width and height, better to have a slightly bigger box then a too small one
        m_boundingRect = new Rectangle((int)leftMoast, (int)topMost, (int)Math.Ceiling(rightMost - leftMoast),(int) Math.Ceiling(bottomMost - topMost));
    }
Exemple #2
0
 internal static void InitializeBGImage(GLEED2D.Item item)
 {
     throw new NotImplementedException();
 }
Exemple #3
0
 internal static void CreateTrigger(GLEED2D.Item item)
 {
     throw new NotImplementedException();
 }
Exemple #4
0
 internal static void CreateShadowHull(GLEED2D.Item item)
 {
     throw new NotImplementedException();
 }
Exemple #5
0
 internal static void CreatePhysicsBlock(GLEED2D.Item item)
 {
     throw new NotImplementedException();
 }
Exemple #6
0
 internal static void CreateJoint(GLEED2D.Item item, GLEED2D.Item i)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 internal static void CreateGlobalLight(GLEED2D.Item item)
 {
     throw new NotImplementedException();
 }