Files
quro-animation-tools/AnimationLibrary/Animation.cs
T
quinnvoker fee1757862 Migration of Animation Code to External Library
Created the AnimationLibrary library to hold both Animation and AnimatedSprite.
2018-11-17 11:24:20 -08:00

32 lines
873 B
C#

using MonoGame.Extended.TextureAtlases;
namespace QURO.AnimationLibrary
{
public class Animation
{
public string Name { get; set; }
public bool IsLooping { get; set; }
public float Delay { get; set; }
public TextureRegion2D[] Frames { get; set; }
public bool IsStillImage => Frames.Length <= 1;
public Animation() { }
public Animation(string name, TextureAtlas textureAtlas, string[] frameNames, float delaySetting = 0.2f, bool willLoop = false)
{
Name = name;
Frames = new TextureRegion2D[frameNames.Length];
for (int index = 0; index < frameNames.Length; index++)
{
Frames[index] = textureAtlas.GetRegion(frameNames[index]);
}
IsLooping = willLoop;
Delay = delaySetting;
}
}
}