diff options
Diffstat (limited to 'Plugins/MonoGame.Extended/source/MonoGame.Extended/AnimationComponent.cs')
-rw-r--r-- | Plugins/MonoGame.Extended/source/MonoGame.Extended/AnimationComponent.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Plugins/MonoGame.Extended/source/MonoGame.Extended/AnimationComponent.cs b/Plugins/MonoGame.Extended/source/MonoGame.Extended/AnimationComponent.cs new file mode 100644 index 0000000..28a0e57 --- /dev/null +++ b/Plugins/MonoGame.Extended/source/MonoGame.Extended/AnimationComponent.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using MonoGame.Extended.Sprites; + +namespace MonoGame.Extended.Animations +{ + public class AnimationComponent : GameComponent + { + public AnimationComponent(Game game) + : base(game) + { + Animations = new List<Animation>(); + } + + public List<Animation> Animations { get; } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + + for (var i = Animations.Count - 1; i >= 0; i--) + { + var animation = Animations[i]; + animation.Update(gameTime); + } + + Animations.RemoveAll(a => a.IsDisposed); + } + } +}
\ No newline at end of file |