Beispiel #1
0
        public override bool Collides(CollisionShape a_cs)
        {
            if (a_cs is CollisionRectangle)
            {
                CollisionRectangle t_cr = (CollisionRectangle)a_cs;

                return (m_xOffset + m_position.getGlobalX() < t_cr.m_xOffset + t_cr.m_position.getGlobalX() + t_cr.m_width &&
                    m_xOffset + m_position.getGlobalX() + m_width > t_cr.m_xOffset + t_cr.m_position.getGlobalX() &&
                    m_yOffset + m_position.getGlobalY() < t_cr.m_yOffset + t_cr.m_position.getGlobalY() + t_cr.m_height &&
                    m_yOffset + m_position.getGlobalY() + m_height > t_cr.m_yOffset + t_cr.m_position.getGlobalY());
            }
            else if (a_cs is CollisionTriangle)
            {
                return a_cs.Collides(this);
            }
            return false;
        }
Beispiel #2
0
 public static bool Collides(CollisionShape a_cs1, CollisionShape a_cs2)
 {
     return a_cs1.Collides(a_cs2);
 }