我有个天体,其中都有一个边框每次更新的名单......我怎样才能有效地其中迭代?我认为像这样检查是好的,但任何想法?XNA 4.0 perparing多个碰撞检测与列表
for (int i = 0; i < birds.Count; i++)
{
for (int j = 0; j < birds.Count; j++)
{
if (j > i)
{
if (birds[j].boundingRectangle.Intersects(birds[i].boundingRectangle))
{
birds[i].tintColor = Color.Yellow;
birds[j].tintColor = Color.Yellow;
}
else
{
birds[i].tintColor = Color.White;
birds[j].tintColor = Color.White;
}
}
}
}
此外,返回我的长方形,Color.White每次ofcourse ... :( – JML