/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
{
Exit();
}
timesincelastTick += gameTime.ElapsedGameTime.Milliseconds;
if (timesincelastTick > MilisecondsperTick && partyTime == true)
{
changeBGcolor = true; timesincelastTick -= MilisecondsperTick;
for (int i = 0; i < 3; i++)
{
balloons.Add(new Balloon(Content, random));
}
for (int i = 0; i < 900; i++)
{
conffettis.Add(new conffetti(Content, random));
}
}
if (timesincelastTick > MilisecondsperTick && partyTime == false)
{
changeBGcolor = false; timesincelastTick -= MilisecondsperTick;
}
inputs.Update();
// TODO: Add your update logic here
player.Update(gameTime);
for (int i = 0; i < balloons.Count; i++)
{
balloons[i].Update(gameTime);
if (balloons[i].isGone == true)
{
balloons.RemoveAt(i);
}
}
for (int i = 0; i < conffettis.Count; i++)
{
conffettis[i].Update(gameTime);
if (conffettis[i].isGone == true)
{
conffettis.RemoveAt(i);
}
}
base.Update(gameTime);
}