Show / Hide Table of Contents

Class WeaverAnimationPlayer

Used for playing sprite animations

Inheritance
object
Object
Component
Behaviour
MonoBehaviour
WeaverAnimationPlayer
Namespace: WeaverCore.Components
Assembly: WeaverCore.dll
Syntax
public class WeaverAnimationPlayer : MonoBehaviour

Fields

| Edit this page View Source

OnClipFinish

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 Source

AnimationData

The sprite animation data this player will be using

Declaration
public WeaverAnimationData AnimationData { get; set; }
Property Value
Type Description
WeaverAnimationData
| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

PlaybackSpeed

How fast the animations will be played at

Declaration
public float PlaybackSpeed { get; set; }
Property Value
Type Description
float
| Edit this page View Source

PlayingClip

The currently playing clip. Returns null if no clip is playing

Declaration
public string PlayingClip { get; }
Property Value
Type Description
string
| Edit this page View Source

PlayingFrame

The current frame index that is playing

Declaration
public int PlayingFrame { get; }
Property Value
Type Description
int
| Edit this page View Source

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
| Edit this page View Source

SpriteRenderer

Declaration
public SpriteRenderer SpriteRenderer { get; }
Property Value
Type Description
SpriteRenderer
| Edit this page View Source

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 Source

HasAnimationClip(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
| Edit this page View Source

OnEnable()

Declaration
protected virtual void OnEnable()
| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

OnValidate()

Declaration
protected virtual void OnValidate()
| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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
| Edit this page View Source

SkipFrame()

Immediately skips the current frame

Declaration
public void SkipFrame()
| Edit this page View Source

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

| Edit this page View Source

StopCurrentAnimation()

If an animation is currently being played, this will stop it

Declaration
public void StopCurrentAnimation()
| Edit this page View Source

Update()

Declaration
protected virtual void Update()
| Edit this page View Source

WaitforClipToFinish()

If a clip is currently playing, this will wait until the clip is done

Declaration
public IEnumerator WaitforClipToFinish()
Returns
Type Description
IEnumerator

Extension Methods

ReflectionUtilities.ReflectCallMethod(object, string, object[], BindingFlags)
ReflectionUtilities.ReflectGetField(object, string, BindingFlags)
ReflectionUtilities.ReflectGetMethod(object, string, BindingFlags)
ReflectionUtilities.ReflectGetProperty(object, string, BindingFlags)
ReflectionUtilities.ReflectSetField(object, string, object, BindingFlags)
ReflectionUtilities.ReflectSetProperty(object, string, object, BindingFlags)
CoroutineUtilities.RunCoroutineWhile<T>(T, IEnumerator, Func<bool>)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾