public Sector(Entity aAttacker, UInt16 aAttackX, UInt16 aAttackY) { mAttackerX = aAttacker.X; mAttackerY = aAttacker.Y; mAttackX = aAttackX; mAttackY = aAttackY; mDegree = MyMath.GetDirection(mAttackerX, mAttackX, mAttackerY, mAttackY); mLeftSide = 0; mRightSide = 0; mDistance = 0; mAddExtra = false; }
public bool Inside(UInt16 aPosX, UInt16 aPosY) { if (MyMath.GetDistance(aPosX, aPosY, mAttackerX, mAttackerY) <= mDistance) { int degree = MyMath.GetDirection(mAttackerX, aPosX, mAttackerY, aPosY); if (mAddExtra) { degree += 360; } if (degree >= mLeftSide && degree <= mRightSide) { return(true); } } return(false); }