Class SpriteAnimationSystem
A system in charge of animating the sprites
public class SpriteAnimationSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
- Inheritance
-
objectSpriteAnimationSystem
- Implements
- Inherited Members
- Extension Methods
Constructors
SpriteAnimationSystem(IServiceRegistry)
Creates a new instance of SpriteAnimationSystem and register it in the services.
public SpriteAnimationSystem(IServiceRegistry registry)
Parameters
registryIServiceRegistry
Properties
DefaultFramesPerSecond
Gets or sets the default sprite animation FPS (Default value = 30 FPS).
public float DefaultFramesPerSecond { get; set; }
Property Value
Methods
Draw(GameTime)
Draws this instance.
public override void Draw(GameTime gameTime)
Parameters
gameTimeGameTimeThe current timing.
Initialize()
This method is called when the component is added to the game.
public override void Initialize()
Remarks
This method can be used for tasks like querying for services the component needs and setting up non-graphics resources.
Pause(SpriteComponent)
Pauses the animation of the provided sprite component.
public void Pause(SpriteComponent spriteComponent)
Parameters
spriteComponentSpriteComponentthe sprite component to pause
Play(SpriteComponent, int, int, AnimationRepeatMode, float, bool)
Play the sprite animation starting at index startIndex and ending at endIndex.
public void Play(SpriteComponent spriteComponent, int startIndex, int endIndex, AnimationRepeatMode repeatMode, float framesPerSeconds = 0, bool clearQueuedAnimations = true)
Parameters
spriteComponentSpriteComponentThe sprite component containing the animation
startIndexintThe first index of the animation
endIndexintThe last index of the animation
repeatModeAnimationRepeatModeThe value indicating how to loop the animation
framesPerSecondsfloatThe animation speed in frames per second. 0 to use the sprite animation system default speed.
clearQueuedAnimationsboolIndicate if queued animation should be cleared
Play(SpriteComponent, int[], AnimationRepeatMode, float, bool)
Play the sprite animation defined by the provided sequence of indices.
public void Play(SpriteComponent spriteComponent, int[] indices, AnimationRepeatMode repeatMode, float framesPerSeconds = 0, bool clearQueuedAnimations = true)
Parameters
spriteComponentSpriteComponentThe sprite component containing the animation
indicesint[]The sequence of indices defining the sprite animation
repeatModeAnimationRepeatModeThe value indicating how to loop the animation
framesPerSecondsfloatThe animation speed in frames per second. 0 to use the sprite animation system default speed.
clearQueuedAnimationsboolIndicate if queued animation should be cleared
Queue(SpriteComponent, int, int, AnimationRepeatMode, float)
Queue the sprite animation starting at index startIndex and ending at endIndex at the end of the animation queue.
public void Queue(SpriteComponent spriteComponent, int startIndex, int endIndex, AnimationRepeatMode repeatMode, float framesPerSeconds = 0)
Parameters
spriteComponentSpriteComponentThe sprite component containing the animation
startIndexintThe first index of the animation
endIndexintThe last index of the animation
repeatModeAnimationRepeatModeThe value indicating how to loop the animation
framesPerSecondsfloatThe animation speed in frames per second. 0 to use the sprite animation system default speed.
Queue(SpriteComponent, int[], AnimationRepeatMode, float)
Queue the sprite animation defined by the provided sequence of indices at the end of the animation queue.
public void Queue(SpriteComponent spriteComponent, int[] indices, AnimationRepeatMode repeatMode, float framesPerSeconds = 0)
Parameters
spriteComponentSpriteComponentThe sprite component containing the animation
indicesint[]The sequence of indices defining the sprite animation
repeatModeAnimationRepeatModeThe value indicating how to loop the animation
framesPerSecondsfloatThe animation speed in frames per second. 0 to use the sprite animation system default speed.
Resume(SpriteComponent)
Resumes a previously paused animation.
public void Resume(SpriteComponent spriteComponent)
Parameters
spriteComponentSpriteComponentthe sprite component to resume
Stop(SpriteComponent)
Stops the animation of the provided sprite component.
public void Stop(SpriteComponent spriteComponent)
Parameters
spriteComponentSpriteComponentthe sprite component to stop