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 { /// /// Used as a wrapper for the AnimatedSprite class. /// public class AnimatedSpriteExtended { /// /// The actual sprite of the object. /// public AnimatedSprite sprite; /// /// The path to the texture to load the sprite from. /// 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. /// Path used for retaining texture location on disk. /// Starting animation frame. /// Sprite width. /// Sprite height public AnimatedSpriteExtended(Texture2D texture,string path ,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); } } }