SpriteSheetAnimation.cs 895 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) Craftwork Games. All rights reserved.
  2. // Licensed under the MIT license.
  3. // See LICENSE file in the project root for full license information.
  4. using System;
  5. using MonoGame.Extended.Animations;
  6. namespace MonoGame.Extended.Graphics;
  7. public class SpriteSheetAnimation : IAnimation
  8. {
  9. private readonly SpriteSheetAnimationFrame[] _frames;
  10. public string Name { get; }
  11. public ReadOnlySpan<IAnimationFrame> Frames => _frames;
  12. public int FrameCount => _frames.Length;
  13. public bool IsLooping { get; }
  14. public bool IsReversed { get; }
  15. public bool IsPingPong { get; }
  16. internal SpriteSheetAnimation(string name, SpriteSheetAnimationFrame[] frames, bool isLooping, bool isReversed, bool isPingPong)
  17. {
  18. Name = name;
  19. IsLooping = isLooping;
  20. IsReversed = isReversed;
  21. IsPingPong = isPingPong;
  22. _frames = frames;
  23. }
  24. }