public PowerUpMenu(Texture2D background, IMenuItem[,] items, Rectangle itemZone, String key) : base(background, items, itemZone) { selected = (PowerUpMenuItem)items[0, 0]; selected.SetIsSelected(true); this.key = key; }
public override void UpdateMenu(Game1 game) { foreach (IMenuItem i in items) { if (i is PowerUpMenuItem) { PowerUpMenuItem i2 = (PowerUpMenuItem)i; if (!i2.GetIsSelected() && game.GetPowerUpManager().AbilityUsed(i2.GetPowerUp())) { i2.SetAbilityUsed(true); } else { i2.SetAbilityUsed(false); } } } base.UpdateMenu(game); }
public override void ActivateItem(Game1 game) { if (this.items[GetCurrentItemX(), GetCurrentItemY()] is PowerUpMenuItem) { PowerUpMenuItem newSelected = (PowerUpMenuItem)items[GetCurrentItemX(), GetCurrentItemY()]; if (selected != newSelected && game.GetPowerUpManager().GetUnlockedPowerUps().Contains(newSelected.GetPowerUp()) && !game.GetPowerUpManager().AbilityUsed(newSelected.GetPowerUp()) && newSelected.GetPowerUp() != PowerUps.NULL) { selected.SetIsSelected(false); selected = newSelected; base.ActivateItem(game); } } else { base.ActivateItem(game); } }