mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-26 00:45:20 +00:00
* Changed obsolete code in the demos * Unit Test commit was a mistake * Extra tab was added by mistake
31 lines
872 B
C#
31 lines
872 B
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using MonoGame.Extended.Animations;
|
|
using MonoGame.Extended.Animations.SpriteSheets;
|
|
using MonoGame.Extended.Sprites;
|
|
|
|
namespace Demo.SpaceGame.Entities
|
|
{
|
|
public class Explosion : Entity
|
|
{
|
|
private readonly AnimatedSprite _sprite;
|
|
|
|
public Explosion(SpriteSheetAnimationFactory animations, Vector2 position, float radius)
|
|
{
|
|
_sprite = new AnimatedSprite(animations);
|
|
_sprite.Position = position;
|
|
_sprite.Scale = Vector2.One*radius*0.2f;
|
|
_sprite.Play("explode", Destroy);
|
|
}
|
|
|
|
public override void Update(GameTime gameTime)
|
|
{
|
|
_sprite.Update(gameTime);
|
|
}
|
|
|
|
public override void Draw(SpriteBatch spriteBatch)
|
|
{
|
|
spriteBatch.Draw(_sprite);
|
|
}
|
|
}
|
|
} |