Explosion.cs 696 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Xna.Framework;
  7. using Tutorial020.Models;
  8. namespace Tutorial020.Sprites
  9. {
  10. public class Explosion : Sprite
  11. {
  12. private float _timer = 0f;
  13. public Explosion(Dictionary<string, Animation> animations) : base(animations)
  14. {
  15. }
  16. public override void Update(GameTime gameTime)
  17. {
  18. _animationManager.Update(gameTime);
  19. _timer += (float)gameTime.ElapsedGameTime.TotalSeconds;
  20. if (_timer > _animationManager.CurrentAnimation.FrameCount * _animationManager.CurrentAnimation.FrameSpeed)
  21. IsRemoved = true;
  22. }
  23. }
  24. }