public override bool Equals(Object obj) { CollisionExemplar bodyBasics2 = obj as CollisionExemplar; if (bodyBasics2 == null) { return(false); } else { if (Player1JointType1 == bodyBasics2.Player1JointType1 && Player1JointType2 == bodyBasics2.Player1JointType2 && Player2JointType1 == bodyBasics2.Player2JointType1 && Player2JointType2 == bodyBasics2.Player2JointType2) { return(true); } } return(false); }
public void DetectCollision(BallModel ballModel, ArrayList collisions) { for (int a = 0; a < balls.Count; a++) { for (int b = a; b < ballModel.balls.Count; b++) { BallBoundingBox bbb = (BallBoundingBox)balls[a]; BallBoundingBox bbb2 = (BallBoundingBox)ballModel.balls[b]; if (bbb.Collide(bbb2)) { if (collisions != null) { CollisionExemplar ce = new CollisionExemplar(bbb.JointType1, bbb.JointType2, bbb2.JointType1, bbb2.JointType2); if (!collisions.Contains(ce)) { collisions.Add(ce); } } } } } }