public void SetCooldown(int i, int cooldown) { if (i == 0) { powerUp1 = new Cooldown(cooldown); } if (i == 1) { powerUp2 = new Cooldown(cooldown); } if (i == 2) { powerUp3 = new Cooldown(cooldown); } }
public void HandlePowerUp(PowerUps pu, int position) { Keys key = Game1.special1; if (position == 1) { key = Game1.special2; } if (position == 2) { key = Game1.special3; } Cooldown cooldown = powerUp1; if (position == 1) { cooldown = powerUp2; } if (position == 2) { cooldown = powerUp3; } switch (pu) { case PowerUps.Warp: if (IsKeyPressed(key)) { if (cooldown.Iterate()) { cooldown.SetCooldown(); } } else { cooldown.Iterate(); } if (cooldown.GetCurrent() > cooldown.GetMax() - 7) { SetXVel(BOOST_SPEED * (mirrorX ? -1 : 1)); SetYVel(0); SetColor(Color.LightBlue); if (cooldown.GetCurrent() != cooldown.GetMax() - 7 && cooldown.GetCurrent() < cooldown.GetMax() - 1) { this.destRect.Width = this.spriteWidth + BOOST_SPEED; if (!mirrorX) { this.destRectXOffset = -BOOST_SPEED; } } else { this.destRectXOffset = 0; } } else { SetColor(Color.White); this.destRectXOffset = 0; this.destRect.Width = this.spriteWidth; if (cooldown.GetCurrent() > cooldown.GetMax() - 5) { SetXVel(10 * (mirrorX ? -1 : 1)); } } break; //case PowerUps.Liquid: // if (IsKeyPressed(key)) // { // if (cooldown.Iterate()) // cooldown.SetCooldown(); // } // else // { // cooldown.Iterate(); // } // if(cooldown.GetCurrent() > cooldown.GetMax) // break; } }