From ee9f0465622ead63d5208f8e14777fa58bfc9bcf Mon Sep 17 00:00:00 2001 From: Tim Young Date: Mon, 18 Sep 2017 07:41:02 -0500 Subject: [PATCH] Update a sprite-info from another sprite-info --- SpriteLibrary/SpriteInfo.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SpriteLibrary/SpriteInfo.cs b/SpriteLibrary/SpriteInfo.cs index 1e3754a..75fe6bd 100644 --- a/SpriteLibrary/SpriteInfo.cs +++ b/SpriteLibrary/SpriteInfo.cs @@ -49,6 +49,22 @@ namespace SpriteLibrary return SpriteDatabase.CloneByXMLSerializing(this); } + /// + /// Update the current SpriteInfo class such that it is identical to the class you are copying from. + /// + /// A spriteInfo class + 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) { Sprite DestSprite = null;