public bool IsNearRotated(BaseObject r, float factor) { Rectangle inflatedRectangle = new Rectangle(X, Y, Width, Height); inflatedRectangle.Inflate((int)(Width * factor), (int)(Height * factor)); return(r.Intersects(inflatedRectangle)); }
void checkForSledgeHammerHits() { if (sledgeHammerInUse) { if (alex is AlexEnchanter && ((AlexEnchanter)alex).HasPeanutShield) { if (sledgeHammer.Intersects(alex)) { ((AlexEnchanter)alex).BreakPeanutShield(); soundEffectManager.Play(peanutShieldBreakSound, .25f); } } } }
void checkForSledgeHammerHits() { if (sledgeHammerInUse) { for (int i = 0; i < Bullet.Cans.Count;) { Bullet b = Bullet.Cans[i]; if (sledgeHammer.Intersects(b)) { soundEffectManager.Play(canDeath, .5f); Bullet.Cans.Remove(b); } else { i++; } } } }
public bool IsNearRotated(BaseObject r, float factor) { Rectangle inflatedRectangle = new Rectangle(X, Y, Width, Height); inflatedRectangle.Inflate((int)(Width * factor), (int)(Height * factor)); return r.Intersects(inflatedRectangle); }