mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-24 20:12:23 +00:00
32 lines
900 B
C#
32 lines
900 B
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using MonoGame.Extended.Animations;
|
|
using MonoGame.Extended.Sprites;
|
|
|
|
namespace SpaceGame.Entities
|
|
{
|
|
public class Explosion : Entity
|
|
{
|
|
private readonly SpriteSheetAnimator _animator;
|
|
|
|
public Explosion(SpriteSheetAnimationGroup animations, Vector2 position, float radius)
|
|
{
|
|
_animator = new SpriteSheetAnimator(animations)
|
|
{
|
|
Sprite = { Position = position, Scale = Vector2.One * radius * 0.2f },
|
|
IsLooping = false
|
|
};
|
|
_animator.PlayAnimation("explode", Destroy);
|
|
}
|
|
|
|
public override void Update(GameTime gameTime)
|
|
{
|
|
_animator.Update(gameTime);
|
|
}
|
|
|
|
public override void Draw(SpriteBatch spriteBatch)
|
|
{
|
|
spriteBatch.Draw(_animator);
|
|
}
|
|
}
|
|
} |