TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.Feedbacks.MMF_SpriteSheetAnimation Class Reference

A feedback used to quickly animate a sprite renderer or an image using a list of sprites, looping or not, at a specified frame rate, with an optional random offset. More...

Inheritance diagram for MoreMountains.Feedbacks.MMF_SpriteSheetAnimation:
MoreMountains.Feedbacks.MMF_Feedback

Public Attributes

List< SpriteRenderer > TargetSpriteRenderers
 the list of SpriteRenderers to animate
List< Image > TargetImages
 the list of Images to animate
List< Sprite > AnimationSprites
 a list of sprites to use as the sequential animation
int FrameRate = 12
 the number of frames per second to use for the animation
Vector2Int RandomOffset = Vector2Int.zero
 the minimum and maximum random offset to apply to the animation, useful to create a bit of variety in the animation
bool Loop = false
 whether the animation should loop or not once it reaches the last sprite in the AnimationSprites list

Static Public Attributes

static bool FeedbackTypeAuthorized = true
 a static bool used to disable all feedbacks of this type at once

Protected Member Functions

virtual float DetermineDuration ()
 Determines the duration of the animation based on the number of sprites and the frame rate.
override void CustomInitialization (MMF_Player owner)
 Custom Init.
override void CustomRestoreInitialValues ()
 On RestoreInitialValues, we restore the initial sprites of our sprite renderers and images.
override void CustomPlayFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On Play, checks if an animator is bound and triggers parameters.
virtual IEnumerator AnimateSprites ()
 Animates the sprites of the target sprite renderers and images at the specified frame rate.
virtual void SetSprite (int index)
 Sets the sprite of the target sprite renderers and images based on the current index and optional offset.
override void CustomStopFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 On stop, we stop the animation coroutine if it's running.
virtual void StopAnimationCoroutine ()
 Stops the animation coroutine if it's running.

Protected Attributes

Coroutine _animationCoroutine
List< int > _spriteRendererOffsets
List< int > _imageOffsets
List< Sprite > _spriteRendererInitialSprites
List< Sprite > _imageInitialSprites

Properties

override float FeedbackDuration [get, set]
 sets the inspector color for this feedback

Additional Inherited Members

Detailed Description

A feedback used to quickly animate a sprite renderer or an image using a list of sprites, looping or not, at a specified frame rate, with an optional random offset.

Member Function Documentation

◆ AnimateSprites()

virtual IEnumerator MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.AnimateSprites ( )
protectedvirtual

Animates the sprites of the target sprite renderers and images at the specified frame rate.

Returns

◆ CustomInitialization()

override void MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.CustomInitialization ( MMF_Player owner)
protectedvirtual

Custom Init.

Parameters
owner

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomPlayFeedback()

override void MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.CustomPlayFeedback ( Vector3 position,
float feedbacksIntensity = 1::0f )
protected

On Play, checks if an animator is bound and triggers parameters.

Parameters
position
feedbacksIntensity

◆ CustomRestoreInitialValues()

override void MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.CustomRestoreInitialValues ( )
protectedvirtual

On RestoreInitialValues, we restore the initial sprites of our sprite renderers and images.

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomStopFeedback()

override void MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.CustomStopFeedback ( Vector3 position,
float feedbacksIntensity = 1::0f )
protectedvirtual

On stop, we stop the animation coroutine if it's running.

Parameters
position
feedbacksIntensity

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ DetermineDuration()

virtual float MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.DetermineDuration ( )
protectedvirtual

Determines the duration of the animation based on the number of sprites and the frame rate.

Returns

◆ SetSprite()

virtual void MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.SetSprite ( int index)
protectedvirtual

Sets the sprite of the target sprite renderers and images based on the current index and optional offset.

Parameters
index

◆ StopAnimationCoroutine()

virtual void MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.StopAnimationCoroutine ( )
protectedvirtual

Stops the animation coroutine if it's running.

Member Data Documentation

◆ _animationCoroutine

Coroutine MoreMountains.Feedbacks.MMF_SpriteSheetAnimation._animationCoroutine
protected

◆ _imageInitialSprites

List<Sprite> MoreMountains.Feedbacks.MMF_SpriteSheetAnimation._imageInitialSprites
protected

◆ _imageOffsets

List<int> MoreMountains.Feedbacks.MMF_SpriteSheetAnimation._imageOffsets
protected

◆ _spriteRendererInitialSprites

List<Sprite> MoreMountains.Feedbacks.MMF_SpriteSheetAnimation._spriteRendererInitialSprites
protected

◆ _spriteRendererOffsets

List<int> MoreMountains.Feedbacks.MMF_SpriteSheetAnimation._spriteRendererOffsets
protected

◆ AnimationSprites

List<Sprite> MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.AnimationSprites

a list of sprites to use as the sequential animation

◆ FeedbackTypeAuthorized

bool MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.FeedbackTypeAuthorized = true
static

a static bool used to disable all feedbacks of this type at once

◆ FrameRate

int MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.FrameRate = 12

the number of frames per second to use for the animation

◆ Loop

bool MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.Loop = false

whether the animation should loop or not once it reaches the last sprite in the AnimationSprites list

◆ RandomOffset

Vector2Int MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.RandomOffset = Vector2Int.zero

the minimum and maximum random offset to apply to the animation, useful to create a bit of variety in the animation

◆ TargetImages

List<Image> MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.TargetImages

the list of Images to animate

◆ TargetSpriteRenderers

List<SpriteRenderer> MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.TargetSpriteRenderers

the list of SpriteRenderers to animate

Property Documentation

◆ FeedbackDuration

override float MoreMountains.Feedbacks.MMF_SpriteSheetAnimation.FeedbackDuration
getset

sets the inspector color for this feedback

the duration of this feedback is the declared duration


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/ThirdParty/MoreMountains/MMFeedbacks/MMFeedbacks/Feedbacks/MMF_SpriteSheetAnimation.cs