Class WeaverAnimationData
Contains a series of animation clips that can be played with WeaverAnimationPlayer
Inherited Members
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
[CreateAssetMenu(fileName = "WeaverAnimation", menuName = "WeaverCore/Weaver Sprite Animation Data")]
public class WeaverAnimationData : ScriptableObject
Properties
| Edit this page View SourceAllClips
A list of all added clips
Declaration
public IEnumerable<WeaverAnimationData.Clip> AllClips { get; }
Property Value
Type | Description |
---|---|
IEnumerable<WeaverAnimationData.Clip> |
AnimationCount
How many clips have been added
Declaration
public int AnimationCount { get; }
Property Value
Type | Description |
---|---|
int |
ClipCount
The amount of clips added to the data object
Declaration
public int ClipCount { get; }
Property Value
Type | Description |
---|---|
int |
ClipNames
A list of all added clip names
Declaration
public IEnumerable<string> ClipNames { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Methods
| Edit this page View SourceAddClip(Clip)
Adds a clip
Declaration
public bool AddClip(WeaverAnimationData.Clip clip)
Parameters
Type | Name | Description |
---|---|---|
WeaverAnimationData.Clip | clip | The clip to be added |
Returns
Type | Description |
---|---|
bool | Returns true if the clip is added, or false of the clip is already added |
Clear()
Removes all clips from the animation data object
Declaration
public void Clear()
GetClip(string)
Finds a clip with the specified name
Declaration
public WeaverAnimationData.Clip GetClip(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to look for |
Returns
Type | Description |
---|---|
WeaverAnimationData.Clip | Returns the clip with the specified name |
Exceptions
Type | Condition |
---|---|
Exception | Throws an exception if the clip does not exist |
GetClipDuration(string)
Gets the duration of a specific clip
Declaration
public float GetClipDuration(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName |
Returns
Type | Description |
---|---|
float |
GetClipFPS(string)
Gets the FPS of a certain clip
Declaration
public float GetClipFPS(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName |
Returns
Type | Description |
---|---|
float |
GetClipFrameCount(string)
Gets the amount of frames in a specific clip
Declaration
public int GetClipFrameCount(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName |
Returns
Type | Description |
---|---|
int |
GetClipWrapMode(string)
Gets the wrap mode for the specified clip. Throws an exception if the clip doesn't exist
Declaration
public WeaverAnimationData.WrapMode GetClipWrapMode(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The clip to retrieve the wrap mode from |
Returns
Type | Description |
---|---|
WeaverAnimationData.WrapMode | Returns the wrap mode for the clip |
GetFrameFromClip(string, int)
Given a frame index, will get the sprite corresponding to that frame
Declaration
public Sprite GetFrameFromClip(string clipName, int frameIndex)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The clip to get the frame from |
int | frameIndex | The frame index |
Returns
Type | Description |
---|---|
Sprite | Returns the sprite at the frame index |
GetStartingFrame(string)
Gets the first frame of a clip
Declaration
public int GetStartingFrame(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The clip to get the first frame of |
Returns
Type | Description |
---|---|
int | Returns the starting frame of the clip |
Exceptions
Type | Condition |
---|---|
Exception | Throws if the clip doesn't exist in the Animation Data Object |
GoToNextFrame(string, int)
Increments the clip to the next frame. Returns -1 if the animation is completed
Declaration
public int GoToNextFrame(string clipName, int previousFrame)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The clip to increment to the next frame |
int | previousFrame | The previous frame the clip was on |
Returns
Type | Description |
---|---|
int | The new frame the clip should go to, or -1 if the clip is done |
Exceptions
Type | Condition |
---|---|
Exception | Throws an exception if the clip does not exist in the animation data object |
GoToNextFrame(string, int, WrapMode)
Given the wrap mode and previous frame of a clip, will give the next frame in the clip
Declaration
public int GoToNextFrame(string clipName, int previousFrame, WeaverAnimationData.WrapMode wrapMode)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to get the frame from |
int | previousFrame | The previous frame in the clip |
WeaverAnimationData.WrapMode | wrapMode | The wrap mode of the clip |
Returns
Type | Description |
---|---|
int | Returns the next frame in the clip's sequence |
HasClip(string)
Returns whether the clip with the specified name is added
Declaration
public bool HasClip(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The clip name to check for |
Returns
Type | Description |
---|---|
bool | Returns whether the clip with the specified name is added |
HasClip(Clip)
Returns whether the clip has been added
Declaration
public bool HasClip(WeaverAnimationData.Clip clip)
Parameters
Type | Name | Description |
---|---|---|
WeaverAnimationData.Clip | clip | The clip to check for |
Returns
Type | Description |
---|---|
bool | Returns whether the clip has been added |
RemoveClip(string)
Removes a clip with the specified name
Declaration
public bool RemoveClip(string clipName)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to remove |
Returns
Type | Description |
---|---|
bool | Returns whether the clip has been removed |
RemoveClip(Clip)
Removes a clip
Declaration
public bool RemoveClip(WeaverAnimationData.Clip clip)
Parameters
Type | Name | Description |
---|---|---|
WeaverAnimationData.Clip | clip | The clip to remove |
Returns
Type | Description |
---|---|
bool | Returns whether the clip has been removed |
TryGetClip(string, out Clip)
Attempts to get a clip with the specified name
Declaration
public bool TryGetClip(string clipName, out WeaverAnimationData.Clip clip)
Parameters
Type | Name | Description |
---|---|---|
string | clipName | The name of the clip to get |
WeaverAnimationData.Clip | clip | The output clip |
Returns
Type | Description |
---|---|
bool | Returns true if a clip was found |