internal void Destroy(Contact contact) { Fixture fixtureA = contact.FixtureA; Fixture fixtureB = contact.FixtureB; Body bodyA = fixtureA.Body; Body bodyB = fixtureB.Body; if (contact.IsTouching) { //Report the separation to both participants: if (fixtureA != null && fixtureA.OnSeparation != null) { fixtureA.OnSeparation(fixtureA, fixtureB); } //Reverse the order of the reported fixtures. The first fixture is always the one that the //user subscribed to. if (fixtureB != null && fixtureB.OnSeparation != null) { fixtureB.OnSeparation(fixtureB, fixtureA); } if (EndContact != null) { EndContact(contact); } } // Remove from the world. ContactList.Remove(contact); // Remove from body 1 if (contact._nodeA.Prev != null) { contact._nodeA.Prev.Next = contact._nodeA.Next; } if (contact._nodeA.Next != null) { contact._nodeA.Next.Prev = contact._nodeA.Prev; } if (contact._nodeA == bodyA.ContactList) { bodyA.ContactList = contact._nodeA.Next; } // Remove from body 2 if (contact._nodeB.Prev != null) { contact._nodeB.Prev.Next = contact._nodeB.Next; } if (contact._nodeB.Next != null) { contact._nodeB.Next.Prev = contact._nodeB.Prev; } if (contact._nodeB == bodyB.ContactList) { bodyB.ContactList = contact._nodeB.Next; } #if USE_ACTIVE_CONTACT_SET if (ActiveContacts.Contains(contact)) { ActiveContacts.Remove(contact); } #endif contact.Destroy(); }
internal void Destroy(Contact contact) { Fixture fixtureA = contact.FixtureA; Fixture fixtureB = contact.FixtureB; Body body = fixtureA.Body; Body body2 = fixtureB.Body; bool isTouching = contact.IsTouching; if (isTouching) { bool flag = fixtureA != null && fixtureA.OnSeparation != null; if (flag) { fixtureA.OnSeparation(fixtureA, fixtureB); } bool flag2 = fixtureB != null && fixtureB.OnSeparation != null; if (flag2) { fixtureB.OnSeparation(fixtureB, fixtureA); } bool flag3 = this.EndContact != null; if (flag3) { this.EndContact(contact); } } this.ContactList.Remove(contact); bool flag4 = contact._nodeA.Prev != null; if (flag4) { contact._nodeA.Prev.Next = contact._nodeA.Next; } bool flag5 = contact._nodeA.Next != null; if (flag5) { contact._nodeA.Next.Prev = contact._nodeA.Prev; } bool flag6 = contact._nodeA == body.ContactList; if (flag6) { body.ContactList = contact._nodeA.Next; } bool flag7 = contact._nodeB.Prev != null; if (flag7) { contact._nodeB.Prev.Next = contact._nodeB.Next; } bool flag8 = contact._nodeB.Next != null; if (flag8) { contact._nodeB.Next.Prev = contact._nodeB.Prev; } bool flag9 = contact._nodeB == body2.ContactList; if (flag9) { body2.ContactList = contact._nodeB.Next; } contact.Destroy(); }