Class SpriteAnimationSystem
A system in charge of animating the sprites
public class SpriteAnimationSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
- Inheritance
-
SpriteAnimationSystem
- 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
registry
IServiceRegistry
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
gameTime
GameTimeThe 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
spriteComponent
SpriteComponentthe 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
spriteComponent
SpriteComponentThe sprite component containing the animation
startIndex
intThe first index of the animation
endIndex
intThe last index of the animation
repeatMode
AnimationRepeatModeThe value indicating how to loop the animation
framesPerSeconds
floatThe animation speed in frames per second. 0 to use the sprite animation system default speed.
clearQueuedAnimations
boolIndicate 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
spriteComponent
SpriteComponentThe sprite component containing the animation
indices
int[]The sequence of indices defining the sprite animation
repeatMode
AnimationRepeatModeThe value indicating how to loop the animation
framesPerSeconds
floatThe animation speed in frames per second. 0 to use the sprite animation system default speed.
clearQueuedAnimations
boolIndicate 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
spriteComponent
SpriteComponentThe sprite component containing the animation
startIndex
intThe first index of the animation
endIndex
intThe last index of the animation
repeatMode
AnimationRepeatModeThe value indicating how to loop the animation
framesPerSeconds
floatThe 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
spriteComponent
SpriteComponentThe sprite component containing the animation
indices
int[]The sequence of indices defining the sprite animation
repeatMode
AnimationRepeatModeThe value indicating how to loop the animation
framesPerSeconds
floatThe 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
spriteComponent
SpriteComponentthe sprite component to resume
Stop(SpriteComponent)
Stops the animation of the provided sprite component.
public void Stop(SpriteComponent spriteComponent)
Parameters
spriteComponent
SpriteComponentthe sprite component to stop