Class WeaverAnimationPlayer
Used for playing sprite animations
Namespace: WeaverCore.Components
Assembly: WeaverCore.dll
Syntax
public class WeaverAnimationPlayer : MonoBehaviour
Fields
| Edit this page View SourceOnClipFinish
Declaration
[Tooltip("Determines the behaviour that occurs when the player is done playing a clip")]
public OnDoneBehaviour OnClipFinish
Field Value
Type | Description |
---|---|
OnDoneBehaviour |
Properties
| Edit this page View SourceAnimationData
The sprite animation data this player will be using
Declaration
public WeaverAnimationData AnimationData { get; set; }
Property Value
Type | Description |
---|---|
WeaverAnimationData |
AutoPlayClip
The clip that is played when the animator starts (assuming autoPlay is set to true)
Declaration
public string AutoPlayClip { get; }
Property Value
Type | Description |
---|---|
string |
FrameTime
When a clip is playing, this is how long the current frame has been displayed for
Declaration
public float FrameTime { get; }
Property Value
Type | Description |
---|---|
float |
PlaybackSpeed
How fast the animations will be played at
Declaration
public float PlaybackSpeed { get; set; }
Property Value
Type | Description |
---|---|
float |
PlayingClip
The currently playing clip. Returns null if no clip is playing
Declaration
public string PlayingClip { get; }
Property Value
Type | Description |
---|---|
string |
PlayingFrame
The current frame index that is playing
Declaration
public int PlayingFrame { get; }
Property Value
Type | Description |
---|---|
int |
PlayingGUID
Each time a new animation is played, this value gets regenerated. This is used to differentiate between different playing animations
Declaration
public Guid PlayingGUID { get; }
Property Value
Type | Description |
---|---|
Guid |
SpriteRenderer
Declaration
public SpriteRenderer SpriteRenderer { get; }
Property Value
Type | Description |
---|---|
SpriteRenderer |
UnscaledTimeMode
If set to true, then the animation will play at the same speed even if the game is paused or the player gets stunned
Declaration
public bool UnscaledTimeMode { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceHasAnimationClip(string)
Does the AnimationData have a clip with the specified name?
Declaration
public bool HasAnimationClip(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The clip name to check for |
Returns
Type | Description |
---|---|
bool |
OnEnable()
Declaration
protected virtual void OnEnable()
OnPlayingAnimation(string)
Called when a new animation is being played
Declaration
protected virtual void OnPlayingAnimation(string clip)
Parameters
Type | Name | Description |
---|---|---|
string | clip | The new clip being played |
OnPlayingFrame(int)
Called when a new frame is being displayed
Declaration
protected virtual void OnPlayingFrame(int frame)
Parameters
Type | Name | Description |
---|---|---|
int | frame | The frame index in the current clip being displayed |
OnValidate()
Declaration
protected virtual void OnValidate()
PlayAnimation(string, Action, bool)
Plays an animation clip with the specified name
Declaration
public void PlayAnimation(string clipName, Action OnDone, bool forceOnce = false)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to be played |
Action | OnDone | An action that is executed when the animation is done playing |
bool | forceOnce | If the clip is set to loop, setting this to true will force it to play once |
PlayAnimation(string, Action<string>, bool)
Plays an animation clip with the specified name
Declaration
public void PlayAnimation(string clipName, Action<string> OnDone, bool forceOnce = false)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to be played |
Action<string> | OnDone | An action that is executed when the animation is done playing |
bool | forceOnce | If the clip is set to loop, setting this to true will force it to play once |
PlayAnimation(string, bool)
Plays an animation clip with the specified name
Declaration
public void PlayAnimation(string clipName, bool forceOnce = false)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to be played |
bool | forceOnce | If the clip is set to loop, setting this to true will force it to play once |
Exceptions
Type | Condition |
---|---|
Exception | Throws if the clip doesn't exist in AnimationData |
PlayAnimationTillDone(string, bool)
Plays an animation clip with the specified name, and waits until it is done
Declaration
public IEnumerator PlayAnimationTillDone(string clipName, bool forceOnce = false)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to be played |
bool | forceOnce | If the clip is set to loop, setting this to true will force it to play once |
Returns
Type | Description |
---|---|
IEnumerator |
SkipFrame()
Immediately skips the current frame
Declaration
public void SkipFrame()
SkipFrames(int)
Immediately skips the specified amount of frames
Declaration
public void SkipFrames(int frames)
Parameters
Type | Name | Description |
---|---|---|
int | frames | The amount of frames to skip. Must be greater than zero in order to do anything |
StopCurrentAnimation()
If an animation is currently being played, this will stop it
Declaration
public void StopCurrentAnimation()
Update()
Declaration
protected virtual void Update()
WaitforClipToFinish()
If a clip is currently playing, this will wait until the clip is done
Declaration
public IEnumerator WaitforClipToFinish()
Returns
Type | Description |
---|---|
IEnumerator |