Animation System Implemented
System is prepared to read its animations from an AnimationSet object now.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using MonoGame.Extended.TextureAtlases;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace QURO.AnimationLibrary
|
||||
{
|
||||
@@ -8,24 +8,10 @@ namespace QURO.AnimationLibrary
|
||||
public bool IsLooping { get; set; }
|
||||
public float Delay { get; set; }
|
||||
|
||||
public TextureRegion2D[] Frames { get; set; }
|
||||
public Rectangle[] 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user