UVAnimation_Auto Class Reference

Inheritance diagram for UVAnimation_Auto:
UVAnimation

List of all members.

Public Types

enum  ANIM_END_ACTION {
  Do_Nothing, Revert_To_Static, Play_Default_Anim, Hide,
  Deactivate, Destroy
}

Public Member Functions

SPRITE_FRAME[] BuildUVAnim (SpriteRoot s)
 Uses the information stored in this class to build a UV animation for the specified sprite.
void Reset ()
 Resets all the animation state vars to ready the object for playing anew.
SPRITE_FRAME GetCurrentFrame ()
 Returns the current frame info without advancing to the next frame.
SPRITE_FRAME GetFrame (int frame)
 Returns the specified frame.
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.
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.
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.
void SetAnim (SPRITE_FRAME[] anim)
 Assigns the specified array of frames to the animation, replacing its current contents.
void SetAnim (TextureAnim anim, int idx)
 Assigns all the various animation info to this animation from the specified TextureAnim, replacing any existing animation data.
void AppendAnim (SPRITE_FRAME[] anim)
 Appends the specified array of frames to the existing animation.
void SetCurrentFrame (int f)
 Sets the current frame of animation.
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().
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().
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().
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().
int GetFrameCount ()
 Returns the number of frames in the animation.
int GetFramesDisplayed ()
 Returns the number of frames displayed by the animation according to its current loop cycles and loop reverse settings.
int GetCurPosition ()
 Returns the (zero-based) index of the current frame.

Public Attributes

Vector2 start
 The pixel coordinates of the lower-left corner of the first frame in the animation sequence.
Vector2 pixelsToNextColumnAndRow
 The number of pixels from the left edge of one sprite frame to the left edge of the next one, and the number of pixels from the top of one sprite frame to the top of the one in the next row. You may also want to think of this as the size (width and height) of each animation cell.
int cols
 The number of columns in the animation.
int rows
 The number of rows in the animation.
int totalCells
 The total number of frames (cells) of animation.
string name
 The name of the animation.
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.
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.
float framerate = 15f
 The rate in frames per second at which to play the animation.
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.
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.

Properties

int StepDirection [get, set]
 The direction in which the animation is currently set to advance. 1 for forwards, -1 for backwards.

Detailed Description

This derived class allows you to specify parameters in-editor that will build an animation for you.


Member Enumeration Documentation

enum UVAnimation::ANIM_END_ACTION [inherited]

The action to take when an animation ends.

Enumerator:
Do_Nothing 

Do nothing when the animation ends.

Revert_To_Static 

Revert to the static image when the animation ends.

Play_Default_Anim 

Play the default animation when the animation ends.

Hide 

Hide the sprite when the animation ends.

Deactivate 

Deactivate the sprite when the animation ends (sets the GameObject's .active property to false).

Destroy 

Destroys the sprite when the animation ends.


Member Function Documentation

void UVAnimation.AppendAnim ( SPRITE_FRAME[]  anim  )  [inherited]

Appends the specified array of frames to the existing animation.

Parameters:
anim Array of ANIM_FRAMEs which hold the UV coordinates defining the animation.
SPRITE_FRAME [] UVAnimation.BuildUVAnim ( Vector2  start,
Vector2  cellSize,
int  cols,
int  rows,
int  totalCells 
) [inherited]

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.

Parameters:
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).
Returns:
Array of SPRITE_FRAME objects that contain the UVs of each frame of animation.
SPRITE_FRAME [] UVAnimation_Auto.BuildUVAnim ( SpriteRoot  s  ) 

Uses the information stored in this class to build a UV animation for the specified sprite.

Parameters:
s The sprite for which the animation will be built.
Returns:
An array of ANIM_FRAMEs that define the animation.
SPRITE_FRAME [] UVAnimation.BuildWrappedUVAnim ( Vector2  start,
Vector2  cellSize,
int  totalCells 
) [inherited]

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.

Parameters:
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.
Returns:
Array of SPRITE_FRAME objects that contain the UVs of each frame of animation.
SPRITE_FRAME [] UVAnimation.BuildWrappedUVAnim ( Vector2  start,
Vector2  cellSize,
int  cols,
int  rows,
int  totalCells 
) [inherited]

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.

Parameters:
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.
Returns:
Array of SPRITE_FRAME objects that contain the UVs of each frame of animation.
int UVAnimation.GetCurPosition (  )  [inherited]

Returns the (zero-based) index of the current frame.

Returns:
Zero-based index of the current frame.
SPRITE_FRAME UVAnimation.GetCurrentFrame (  )  [inherited]

Returns the current frame info without advancing to the next frame.

Returns:
A Rect containing the UV coordinates of the current frame.
float UVAnimation.GetDuration (  )  [inherited]

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().

Returns:
The duration of the animation in seconds. -1 if the animation loops infinitely.
SPRITE_FRAME UVAnimation.GetFrame ( int  frame  )  [inherited]

Returns the specified frame.

Parameters:
frame The zero-based index of the frame.
Returns:
The frame having the specified index.
int UVAnimation.GetFrameCount (  )  [inherited]

Returns the number of frames in the animation.

Returns:
The number of frames in the animation.
int UVAnimation.GetFramesDisplayed (  )  [inherited]

Returns the number of frames displayed by the animation according to its current loop cycles and loop reverse settings.

Returns:
The number of frames displayed, -1 if set to loop infinitely.
float UVAnimation.GetLength (  )  [inherited]

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().

Returns:
The length of the animation in seconds.
void UVAnimation.Reset (  )  [inherited]

Resets all the animation state vars to ready the object for playing anew.

void UVAnimation.SetAnim ( TextureAnim  anim,
int  idx 
) [inherited]

Assigns all the various animation info to this animation from the specified TextureAnim, replacing any existing animation data.

Parameters:
anim Reference to the TextureAnim containing the desired info.
idx The index of this animation.
void UVAnimation.SetAnim ( SPRITE_FRAME[]  anim  )  [inherited]

Assigns the specified array of frames to the animation, replacing its current contents.

Parameters:
anim Array of ANIM_FRAMEs which hold the UV coordinates defining the animation.
void UVAnimation.SetClipPosition ( float  pos  )  [inherited]

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().

Parameters:
pos Percentage of the way through the animation (0-1).
void UVAnimation.SetCurrentFrame ( int  f  )  [inherited]

Sets the current frame of animation.

Parameters:
f The number of the frame.
void UVAnimation.SetPosition ( float  pos  )  [inherited]

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().

Parameters:
pos Percentage of the way through the animation (0-1).

Member Data Documentation

The number of columns in the animation.

float UVAnimation.framerate = 15f [inherited]

The rate in frames per second at which to play the animation.

int UVAnimation.index = -1 [inherited]

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.

int UVAnimation.loopCycles = 0 [inherited]

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.

bool UVAnimation.loopReverse = false [inherited]

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.

string UVAnimation.name [inherited]

The name of the animation.

ANIM_END_ACTION UVAnimation.onAnimEnd = ANIM_END_ACTION.Do_Nothing [inherited]

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.

The number of pixels from the left edge of one sprite frame to the left edge of the next one, and the number of pixels from the top of one sprite frame to the top of the one in the next row. You may also want to think of this as the size (width and height) of each animation cell.

The number of rows in the animation.

The pixel coordinates of the lower-left corner of the first frame in the animation sequence.

The total number of frames (cells) of animation.


Property Documentation

int UVAnimation.StepDirection [get, set, inherited]

The direction in which the animation is currently set to advance. 1 for forwards, -1 for backwards.


The documentation for this class was generated from the following file:

Generated on Thu Sep 8 16:31:21 2011 for EZ GUI by  doxygen 1.6.1