Public Member Functions | |
void | Reset () |
Resets all the animation state vars to ready the object for playing anew. More... | |
SPRITE_FRAME | GetCurrentFrame () |
Returns the current frame info without advancing to the next frame. More... | |
SPRITE_FRAME | GetFrame (int frame) |
Returns the specified frame. More... | |
SPRITE_FRAME[] | BuildUVAnim (Vector2 start, Vector2 cellSize, int cols, int rows, int totalCells) |
Constructs an array of frames based upon the info supplied. NOTE: When the edge of the texture is reached, this algorithm will "wrap" to the next row down, starting directly below the position of the first animation cell on the row above. More... | |
SPRITE_FRAME[] | BuildWrappedUVAnim (Vector2 start, Vector2 cellSize, int cols, int rows, int totalCells) |
Constructs an array of frames based upon the info supplied. NOTE: When the edge of the texture is reached, this algorithm will "wrap" to the extreme left edge of the atlas. More... | |
SPRITE_FRAME[] | BuildWrappedUVAnim (Vector2 start, Vector2 cellSize, int totalCells) |
Constructs an array of frames based upon the info supplied. NOTE: When the edge of the texture is reached, this algorithm will "wrap" to the extreme left edge of the atlas. More... | |
void | SetAnim (SPRITE_FRAME[] anim) |
Assigns the specified array of frames to the animation, replacing its current contents. More... | |
void | SetAnim (TextureAnim anim, int idx) |
Assigns all the various animation info to this animation from the specified TextureAnim, replacing any existing animation data. More... | |
void | AppendAnim (SPRITE_FRAME[] anim) |
Appends the specified array of frames to the existing animation. More... | |
void | SetCurrentFrame (int f) |
Sets the current frame of animation. More... | |
void | SetPosition (float pos) |
Sets the current frame based on a 0-1 value indicating the desired position in the animation. For example, a position of 0.5 would specify a frame half-way into the animation. A position of 0 would specify the starting frame. A position of 1 would specify the last frame in the animation. NOTE: Loop cycles and loop reverse are taken into account. To set the frame without regard to loop cycles etc, use SetClipPosition(). More... | |
void | SetClipPosition (float pos) |
Sets the current frame based on a 0-1 value indicating the desired position in the animation. For example, a position of 0.5 would specify a frame half-way into the animation. A position of 0 would specify the starting frame. A position of 1 would specify the last frame in the animation. NOTE: Loop cycles and loop reverse are NOT taken into account. Rather, this method sets the desired frame within the clip, the clip being the series of frames 0-n without regard to loop cycles or loop reversing. To set the frame with regard to loop cycles etc, use SetPosition(). More... | |
float | GetLength () |
Returns the length, in seconds, of the animation. NOTE: This does not take into account looping or reversing. It simply returns the length, in seconds, of the animation, when played once from beginning to end. To get the duration of the animation including looping and reversing, use GetDuration(). More... | |
float | GetDuration () |
Returns the duration, in seconds, of the animation. NOTE: This takes into account loop cycles and loop reverse. Ex: If an animation has a framerate of 30fps, consists of 60 frames, and is set to loop once, the duration will be 4 seconds. To retrieve the length of the animation without regard to the loop cycles and loop reverse settings, use GetLength(). More... | |
int | GetFrameCount () |
Returns the number of frames in the animation. More... | |
int | GetFramesDisplayed () |
Returns the number of frames displayed by the animation according to its current loop cycles and loop reverse settings. More... | |
int | GetCurPosition () |
Returns the (zero-based) index of the current frame. More... | |
Public Attributes | |
string | name |
The name of the animation. More... | |
int | loopCycles = 0 |
How many times to loop the animation IN ADDITION to the initial play-through. -1 indicates to loop infinitely. 0 indicates to place the animation once then stop. 1 indicates to repeat the animation once before stopping, and so on. More... | |
bool | loopReverse = false |
Reverse the play direction when the end of the animation is reached? (Ping-pong) If true, a loop iteration isn't counted until the animation returns to the beginning. More... | |
float | framerate = 15f |
The rate in frames per second at which to play the animation More... | |
int | index = -1 |
The index of this animation in the sprite's animation list. This value is only populated by and used for sprites derived from AutoSpriteBase. i.e. SM2 PackedSprites and EZ GUI controls. More... | |
ANIM_END_ACTION | onAnimEnd = ANIM_END_ACTION.Do_Nothing |
What the sprite should do when the animation is done playing. The options are to: 1) Do nothing, 2) return to the static image, 3) play the default animation. More... | |
Properties | |
int | StepDirection [get, set] |
The direction in which the animation is currently set to advance. 1 for forwards, -1 for backwards. More... | |
Describes a UV animation by holding all the information necessary to move the UVs of a sprite across a texture atlas.
Definition at line 16 of file SpriteBase.cs.
The action to take when an animation ends.
Definition at line 21 of file SpriteBase.cs.
void UVAnimation.AppendAnim | ( | SPRITE_FRAME[] | anim | ) |
Appends the specified array of frames to the existing animation.
anim | Array of ANIM_FRAMEs which hold the UV coordinates defining the animation. |
Definition at line 432 of file SpriteBase.cs.
SPRITE_FRAME [] UVAnimation.BuildUVAnim | ( | Vector2 | start, |
Vector2 | cellSize, | ||
int | cols, | ||
int | rows, | ||
int | totalCells | ||
) |
Constructs an array of frames based upon the info supplied. NOTE: When the edge of the texture is reached, this algorithm will "wrap" to the next row down, starting directly below the position of the first animation cell on the row above.
start | The UV of the lower-left corner of the first cell |
cellSize | width and height, in UV space, of each cell |
cols | Number of columns in the grid |
rows | Number of rows in the grid |
totalCells | Total number of cells in the grid (left-to-right, top-to-bottom ordering is assumed, just like reading English). |
Definition at line 281 of file SpriteBase.cs.
SPRITE_FRAME [] UVAnimation.BuildWrappedUVAnim | ( | Vector2 | start, |
Vector2 | cellSize, | ||
int | cols, | ||
int | rows, | ||
int | totalCells | ||
) |
Constructs an array of frames based upon the info supplied. NOTE: When the edge of the texture is reached, this algorithm will "wrap" to the extreme left edge of the atlas.
start | The UV of the lower-left corner of the first cell |
cellSize | width and height, in UV space, of each cell |
cols | This argument is ignored but retained for compatibility. |
rows | This argument is ignored but retained for compatibility. |
totalCells | Total number of cells in the in the animation. |
Definition at line 325 of file SpriteBase.cs.
SPRITE_FRAME [] UVAnimation.BuildWrappedUVAnim | ( | Vector2 | start, |
Vector2 | cellSize, | ||
int | totalCells | ||
) |
Constructs an array of frames based upon the info supplied. NOTE: When the edge of the texture is reached, this algorithm will "wrap" to the extreme left edge of the atlas.
start | The UV of the lower-left corner of the first cell |
cellSize | width and height, in UV space, of each cell |
totalCells | Total number of cells in the in the animation. |
Definition at line 341 of file SpriteBase.cs.
int UVAnimation.GetCurPosition | ( | ) |
Returns the (zero-based) index of the current frame.
Definition at line 613 of file SpriteBase.cs.
SPRITE_FRAME UVAnimation.GetCurrentFrame | ( | ) |
Returns the current frame info without advancing to the next frame.
Definition at line 251 of file SpriteBase.cs.
float UVAnimation.GetDuration | ( | ) |
Returns the duration, in seconds, of the animation. NOTE: This takes into account loop cycles and loop reverse. Ex: If an animation has a framerate of 30fps, consists of 60 frames, and is set to loop once, the duration will be 4 seconds. To retrieve the length of the animation without regard to the loop cycles and loop reverse settings, use GetLength().
Definition at line 567 of file SpriteBase.cs.
SPRITE_FRAME UVAnimation.GetFrame | ( | int | frame | ) |
Returns the specified frame.
frame | The zero-based index of the frame. |
Definition at line 262 of file SpriteBase.cs.
int UVAnimation.GetFrameCount | ( | ) |
Returns the number of frames in the animation.
Definition at line 585 of file SpriteBase.cs.
int UVAnimation.GetFramesDisplayed | ( | ) |
Returns the number of frames displayed by the animation according to its current loop cycles and loop reverse settings.
Definition at line 596 of file SpriteBase.cs.
float UVAnimation.GetLength | ( | ) |
Returns the length, in seconds, of the animation. NOTE: This does not take into account looping or reversing. It simply returns the length, in seconds, of the animation, when played once from beginning to end. To get the duration of the animation including looping and reversing, use GetDuration().
Definition at line 553 of file SpriteBase.cs.
void UVAnimation.Reset | ( | ) |
Resets all the animation state vars to ready the object for playing anew.
Definition at line 159 of file SpriteBase.cs.
void UVAnimation.SetAnim | ( | SPRITE_FRAME[] | anim | ) |
Assigns the specified array of frames to the animation, replacing its current contents.
anim | Array of ANIM_FRAMEs which hold the UV coordinates defining the animation. |
Definition at line 382 of file SpriteBase.cs.
void UVAnimation.SetAnim | ( | TextureAnim | anim, |
int | idx | ||
) |
Assigns all the various animation info to this animation from the specified TextureAnim, replacing any existing animation data.
anim | Reference to the TextureAnim containing the desired info. |
idx | The index of this animation. |
Definition at line 395 of file SpriteBase.cs.
void UVAnimation.SetClipPosition | ( | float | pos | ) |
Sets the current frame based on a 0-1 value indicating the desired position in the animation. For example, a position of 0.5 would specify a frame half-way into the animation. A position of 0 would specify the starting frame. A position of 1 would specify the last frame in the animation. NOTE: Loop cycles and loop reverse are NOT taken into account. Rather, this method sets the desired frame within the clip, the clip being the series of frames 0-n without regard to loop cycles or loop reversing. To set the frame with regard to loop cycles etc, use SetPosition().
pos | Percentage of the way through the animation (0-1). |
Definition at line 533 of file SpriteBase.cs.
void UVAnimation.SetCurrentFrame | ( | int | f | ) |
Sets the current frame of animation.
f | The number of the frame. |
Definition at line 447 of file SpriteBase.cs.
void UVAnimation.SetPosition | ( | float | pos | ) |
Sets the current frame based on a 0-1 value indicating the desired position in the animation. For example, a position of 0.5 would specify a frame half-way into the animation. A position of 0 would specify the starting frame. A position of 1 would specify the last frame in the animation. NOTE: Loop cycles and loop reverse are taken into account. To set the frame without regard to loop cycles etc, use SetClipPosition().
pos | Percentage of the way through the animation (0-1). |
Definition at line 468 of file SpriteBase.cs.
float UVAnimation.framerate = 15f |
The rate in frames per second at which to play the animation
Definition at line 93 of file SpriteBase.cs.
int UVAnimation.index = -1 |
The index of this animation in the sprite's animation list. This value is only populated by and used for sprites derived from AutoSpriteBase. i.e. SM2 PackedSprites and EZ GUI controls.
Definition at line 103 of file SpriteBase.cs.
int UVAnimation.loopCycles = 0 |
How many times to loop the animation IN ADDITION to the initial play-through. -1 indicates to loop infinitely. 0 indicates to place the animation once then stop. 1 indicates to repeat the animation once before stopping, and so on.
Definition at line 78 of file SpriteBase.cs.
bool UVAnimation.loopReverse = false |
Reverse the play direction when the end of the animation is reached? (Ping-pong) If true, a loop iteration isn't counted until the animation returns to the beginning.
Definition at line 86 of file SpriteBase.cs.
string UVAnimation.name |
The name of the animation.
Definition at line 69 of file SpriteBase.cs.
ANIM_END_ACTION UVAnimation.onAnimEnd = ANIM_END_ACTION.Do_Nothing |
What the sprite should do when the animation is done playing. The options are to: 1) Do nothing, 2) return to the static image, 3) play the default animation.
Definition at line 111 of file SpriteBase.cs.
|
getset |
The direction in which the animation is currently set to advance. 1 for forwards, -1 for backwards.
Definition at line 118 of file SpriteBase.cs.