//ショットの衝突判定 for (int i = 0; i < enemy1s.Count; i++) { BoundingBox shotClsn1 = new BoundingBox( new Vector3(shot1pos[i].X, shot1pos[i].Y, 0), new Vector3(shot1pos[i].X + 30, shot1pos[i].Y + 30, 0)); }
//敵さんの衝突判定 for (int i = 0; i < enemy1s.Count; i++) { BoundingBox enemyClsn1 = new BoundingBox( new Vector3(enemy1s[i].X, enemy1s[i].Y, 0), new Vector3(enemy1s[i].X + 30, enemy1s[i].Y + 30, 0)); }
と、このように設定したBoundingBoxですが、for文のブロック外に BoundingBoxの効力が及びません。 本来なら、上記のようにつけた互いの判定を使って、たとえば if (shotClsn1.Intersects(enemyClsn1) == true){} のような条件文で判定を照らし合わせて各種処理をしたいのですが よい方法はありませんでしょうか?