Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override void Update(GameTime gameTime)
- {
- if (IsActive)
- {
- attackTimer -= (float)gameTime.ElapsedGameTime.TotalSeconds;
- if (attackTimer <= 0)
- {
- bombData.relativeTranslation = this.AbsolutePosition() + new Vector3(0, 50, 0);
- if (staticBombPool.Count < 1)
- {
- staticBombPool.Enqueue(new Bomb(Vector3.One, null, bombData));
- }
- else
- {
- Bomb tempBomb = staticBombPool.Dequeue();
- tempBomb.Data = bombData;
- tempBomb.LifeTimer = 0.0f;
- tempBomb.DeserializeData();
- bombs.Add(tempBomb);
- }
- attackTimer = attackFrequencyBase;
- }
- foreach (Bomb bomb in bombs)
- {
- bomb.Update(gameTime);
- }
- for (int i = 0; i < bombs.Count; i++)
- {
- if (bombs[i].LifeTimer > bombs[i].Lifespan)
- {
- Bomb bomb = bombs[i];
- bombs.RemoveAt(i);
- staticBombPool.Enqueue(bomb);
- i--;
- }
- }
- }
- base.Update(gameTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement