Exemplo n.º 1
0
 // 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;
 }
Exemplo n.º 2
0
 void Init(Entity parent, Animation anim)
 {
     currentFrame = 0;
     durationTimer = 0;
     looping = true;
     speed = 1.0f;
     this.parent = parent;
     if (anim != null)
         ChangeAnimation(anim);
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 // 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;
 }
Exemplo n.º 5
0
 // 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;
 }
Exemplo n.º 6
0
 public AnimState(Entity parent, Animation anim)
 {
     Init(parent, anim);
 }