// TODO in future implementations: // Frame flags (for frame-specific effects) public AnimFrame(Texture2D spriteSheet, Rectangle? location, float length, Animation par, SoundEffect sound) { refTex = spriteSheet; spriteCoords = location; parent = par; this.sound = sound; // Default bounding box is the same size as the width and height of the // sprite. if (location != null) { Rectangle loc = (Rectangle)location; boundingBox = new Rectangle(0, 0, loc.Width, loc.Height); } duration = length; }
void Init(Entity parent, Animation anim) { currentFrame = 0; durationTimer = 0; looping = true; speed = 1.0f; this.parent = parent; if (anim != null) ChangeAnimation(anim); }
public void ChangeAnimationWithoutResetting(Animation toAnim, bool loop, float animSpeed) { if (toAnim.name == currentAnim.name) { // Go ahead and update the speed, but that's all, not the animation itself speed = animSpeed; return; } currentAnim = toAnim; currentFrame = 0; durationTimer = 0; looping = true; speed = animSpeed; }
// Changes the current animation and sets an optional "loop" flag // Also sets the speed of the animation public void ChangeAnimation(Animation toAnim, bool loop, float animSpeed) { currentAnim = toAnim; currentFrame = 0; durationTimer = 0; looping = loop; speed = animSpeed; }
// Changes the current animation (or sets up the first one) public void ChangeAnimation(Animation toAnim) { currentAnim = toAnim; currentFrame = 0; durationTimer = 0; looping = true; speed = 1.0f; }
public AnimState(Entity parent, Animation anim) { Init(parent, anim); }