using Microsoft.Xna.Framework.Graphics; using StardewValley; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CustomNPCFramework.Framework.ModularNPCS { public class AnimatedSpriteExtended { public AnimatedSprite sprite; public string path; /// /// Constructor. /// /// Full path to asset. /// Starting animation frame. /// Sprite width. /// Sprite height public AnimatedSpriteExtended(string path,int currentFrame,int spriteWidth, int spriteHeight) { this.path = Class1.getRelativeDirectory(path); this.sprite=new AnimatedSprite(Class1.ModHelper.Content.Load(this.path),currentFrame,spriteWidth,spriteHeight); } /// /// Constructor. /// /// The texture for the sprite. /// Starting animation frame. /// Sprite width. /// Sprite height public AnimatedSpriteExtended(Texture2D texture, int currentFrame, int spriteWidth, int spriteHeight) { this.path = Class1.getRelativeDirectory(path); this.sprite = new AnimatedSprite(texture, currentFrame, spriteWidth, spriteHeight); } /// /// Reloads the asset from disk. /// public void reload() { this.sprite.Texture = Class1.ModHelper.Content.Load(this.path); } } }