0

出于某种原因,我没有掌握这个简单的问题。

if ((paulBoss.Position.Y <= sharkPlayer.Position.Y 
 && paulBoss.Collision.Bottom <= sharkPlayer.Collision.Bottom)
|| (paulBoss.Position.Y >= sharkPlayer.Position.Y 
 && paulBoss.Collision.Bottom >= sharkPlayer.Collision.Bottom))
{
    bossState = BossState.Charge;
}

本质上,我试图确定老板是否真的可以在冲锋前击中玩家,但即使它不在玩家触及范围内,它也在冲锋。

4

1 回答 1

4

(x <= y OR x >= y) is functionally identical to true for any value of x or y

In order words, recheck your conditions. You didn't share implementation specifics, but I'm guessing your if statement is always true.

于 2013-09-18T18:15:24.387 回答