public void ApplyPowerup(PowerupType powerup)
{
//Meteor triggers on pickup, no need to store it.
//Alternatively, it could be stored and triggered on a custom key
//Another alternative - Store it as a once-per-press powerup, and remove it after the first press
if ((powerup & PowerupType.MeteorPowerup) > 0)
{
TriggerMeteor();
return;
}
//This will level us up if we hit another homing missile
if ((powerup & PowerupType.HomingMissiles) > 0)
{
HomingMissileLevel = (short)MathHelper.Min(HomingMissileLevel + 1, 3);
}
// Store the new powerup in the PowerupType bitmask
this.PowerupType = powerup | PowerupType;
//Apply special logic for powerups here
switch (powerup)
{
case PowerupType.Blades:
ApplyBlades();
break;
case PowerupType.EightBallShield:
TriggerEightBallShield();
break;
case PowerupType.TriShield:
ApplyTriShield();
break;
case PowerupType.Ale:
GetDrunk();
break;
case PowerupType.EnergyBlast:
energyBlastLevel++;
break;
case PowerupType.BubbleBeam:
BubbleBullet.POWER_LEVEL++;
break;
}
}