Update a sprite-info from another sprite-info

This commit is contained in:
Tim Young 2017-09-18 07:41:02 -05:00
parent caf7f8cbd2
commit ee9f046562

View File

@ -49,6 +49,22 @@ namespace SpriteLibrary
return SpriteDatabase.CloneByXMLSerializing<SpriteInfo>(this); return SpriteDatabase.CloneByXMLSerializing<SpriteInfo>(this);
} }
/// <summary>
/// Update the current SpriteInfo class such that it is identical to the class you are copying from.
/// </summary>
/// <param name="toCopyFrom">A spriteInfo class</param>
public void CopyFrom(SpriteInfo toCopyFrom)
{
if (toCopyFrom == null) return;
SpriteName = toCopyFrom.SpriteName;
ViewPercent = toCopyFrom.ViewPercent;
Animations.Clear();
foreach(AnimationInfo AI in toCopyFrom.Animations)
{
Animations.Add(AI.Clone());
}
}
public Sprite CreateSprite(SpriteController ControllerToUse, SpriteDatabase TheDatabaseToUse) public Sprite CreateSprite(SpriteController ControllerToUse, SpriteDatabase TheDatabaseToUse)
{ {
Sprite DestSprite = null; Sprite DestSprite = null;