using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardustCore.Animations; namespace StardustCore.Animations { /// /// Deals with animated sprites. /// public class AnimatedSprite { /// /// The position of the sprite. /// public Vector2 position; /// /// The animation manager for the sprite. /// public AnimationManager animation; /// /// The name of the sprite. /// public string name; /// /// The draw color for the sprite. /// public Color color; /// /// Constructor. /// public AnimatedSprite() { } /// /// Constructor. /// /// The name of the sprite. /// The position of the sprite. /// The animation manager for the sprite. /// The draw color for the sprite. public AnimatedSprite(string Name, Vector2 Position, AnimationManager Animation, Color DrawColor) { this.position = Position; this.name = Name; this.animation = Animation; this.color = DrawColor; } /// /// Updates the sprite's logic. /// /// public virtual void Update(GameTime Time) { } /// /// Draws the sprite to the screen. /// /// public virtual void draw(SpriteBatch b,float Alpha=1f) { this.draw(b, 1f, 0f,Alpha); } /// /// Draws the sprite to the screen. /// /// /// /// /// public virtual void draw(SpriteBatch b, float scale, float depth,float alpha=1f) { this.animation.draw(b, this.position, new Color(this.color.R, this.color.G, this.color.B, alpha), scale, SpriteEffects.None, depth); } /// /// Draws the sprite to the screen. /// /// /// /// /// /// /// public virtual void draw(SpriteBatch b,Vector2 position ,float scale, float depth,float alpha=1f) { this.animation.draw(b, position, new Color(this.color.R, this.color.G, this.color.B, alpha), scale, SpriteEffects.None, depth); } /// /// Draws the sprite to the screen. /// /// The spritebatch which to draw the sprite. /// The position on screen. /// The scale of the sprite. /// The rotation of the sprite. /// The depth of the sprite. /// The alpha for the sprite. public virtual void draw(SpriteBatch b, Vector2 position, float scale,float rotation ,float depth,float alpha=1f) { this.animation.draw(b, position, new Color(this.color.R,this.color.G,this.color.B,alpha), scale, rotation,SpriteEffects.None, depth); } /// /// Draws the sprite to the screen. /// /// /// /// /// /// public virtual void draw(SpriteBatch b, Vector2 position, Vector2 scale, float depth,float alpha=1f) { this.animation.draw(b, position, new Color(this.color.R, this.color.G, this.color.B, alpha), scale, SpriteEffects.None, depth); } } }