Animation System Implemented

System is prepared to read its animations from an AnimationSet object now.
This commit is contained in:
quinnvoker
2018-11-17 12:32:14 -08:00
parent fee1757862
commit 65ed454707
6 changed files with 20 additions and 39 deletions
+2 -16
View File
@@ -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;
}
}
}