private void UpdateCollisions() { if (m_Collisions.Count > 0) { m_Collisions.Clear(); } // Iterate through collidable objects and test for collisions between each one for (int i = 0; i < m_Collidables.Count; i++) { for (int j = 0; j < m_Collidables.Count; j++) { Collidable collidable1 = m_Collidables[i]; Collidable collidable2 = m_Collidables[j]; // Make sure we're not checking an object with itself if (!collidable1.Equals(collidable2)) { // If the two objects are colliding then add them to the set if (collidable1.CollisionTest(collidable2)) { m_Collisions.Add(new Collision(collidable1, collidable2)); } } } } }
private void UpdateCollisions() { if (m_Collisions.Count > 0) { m_Collisions.Clear(); } for (int i = 0; i < m_Collidables.Count; i++) { for (int j = 0; j < m_Collidables.Count; j++) { Collidable collidable1 = m_Collidables[i]; Collidable collidable2 = m_Collidables[j]; // Make sure we're not checking an object with itself if (!collidable1.Equals(collidable2)) { // If the two objects are colliding then add them to the set if (collidable1.CollisionTest(collidable2)) { m_Collisions.Add(new Collision(collidable1, collidable2)); } } } } }