public SimpleSpriteAnimation(ISpriteCollection spriteCollection, float frameRate, bool repeatable) { if (null == spriteCollection) { throw new ArgumentNullException("spriteCollection"); } if (spriteCollection.Count < 1) { throw new ArgumentException("Sprite collection is empty. Animated collection should have at least one sprite", "spriteCollection"); } if (frameRate <= 0.0f) { throw new ArgumentException("Frame rate should be greater than 0", "frameRate"); } _sprites = spriteCollection; _frameRate = frameRate; _frameDuration = 1 / frameRate; _firstFrame = 0; _currentFrame = 0; _repeatable = repeatable; }
/// <summary> /// Creates a new instance of the <see cref="SimpleSpriteAnimation"/> class. /// </summary> /// <param name="spriteCollection">The sprite collection.</param> /// <param name="frameRate">The frame rate.</param> public SimpleSpriteAnimation(ISpriteCollection spriteCollection, float frameRate) : this(spriteCollection, frameRate, true) { }