public static b2Contact Create(b2Fixture fixtureA, int indexA, b2Fixture fixtureB, int indexB) { b2ShapeType type1 = fixtureA.ShapeType; b2ShapeType type2 = fixtureB.ShapeType; Debug.Assert(0 <= type1 && type1 < b2ShapeType.e_typeCount); Debug.Assert(0 <= type2 && type2 < b2ShapeType.e_typeCount); var contact = Create(); //Type createFcn = s_registers[(int)type1, (int)type2].contactType; contact._type = s_registers[(int)type1, (int)type2].contactType; //if (createFcn != null) { if (s_registers[(int)type1, (int)type2].isPrimary) { //return ((b2Contact)Activator.CreateInstance(createFcn, new object[] { fixtureA, indexA, fixtureB, indexB })); contact.Init(fixtureA, indexA, fixtureB, indexB); } else { //return ((b2Contact)Activator.CreateInstance(createFcn, new object[] { fixtureB, indexB, fixtureA, indexA })); contact.Init(fixtureB, indexB, fixtureA, indexA); } } return(contact); }
private static void AddType(ContactType createType, b2ShapeType type1, b2ShapeType type2) { Debug.Assert(0 <= type1 && type1 < b2ShapeType.e_typeCount); Debug.Assert(0 <= type2 && type2 < b2ShapeType.e_typeCount); s_registers[(int)type1, (int)type2].contactType = createType; s_registers[(int)type1, (int)type2].isPrimary = true; if (type1 != type2) { s_registers[(int)type2, (int)type1].contactType = createType; s_registers[(int)type2, (int)type1].isPrimary = false; } }
public b2Shape(b2Shape copy) { m_type = copy.m_type; m_radius = copy.m_radius; }
private static void AddType(Type createType, b2ShapeType type1, b2ShapeType type2) { Debug.Assert(0 <= type1 && type1 < b2ShapeType.e_typeCount); Debug.Assert(0 <= type2 && type2 < b2ShapeType.e_typeCount); s_registers[(int)type1, (int)type2].contactType = createType; s_registers[(int)type1, (int)type2].isPrimary = true; if (type1 != type2) { s_registers[(int)type2, (int)type1].contactType = createType; s_registers[(int)type2, (int)type1].isPrimary = false; } }
public b2Shape(b2Shape copy) { ShapeType = copy.ShapeType; Radius = copy.Radius; }