Public Types | |
enum | SPRITE_PLANE |
enum | ANCHOR_METHOD |
enum | WINDING_ORDER |
Public Member Functions | |
override void | Clear () |
Resets important sprite values to defaults for reuse. | |
void | Setup (float w, float h, Vector2 lowerleftPixel, Vector2 pixeldimensions) |
Sets up the essential elements of a sprite. | |
void | Setup (float w, float h, Vector2 lowerleftPixel, Vector2 pixeldimensions, Material material) |
Sets up the essential elements of a sprite. | |
override void | Copy (SpriteRoot s) |
Copies all the attributes of another sprite. | |
void | AddAnimation (UVAnimation_Multi anim) |
Adds an animation to the sprite for its use. | |
void | PlayAnim (UVAnimation_Multi anim) |
Starts playing the specified animation Note: this doesn't resume from a pause, it completely restarts the animation. To unpause, use UnpauseAnim. | |
override void | PlayAnim (int index) |
Starts playing the specified animation Note: this doesn't resume from a pause, it completely restarts the animation. To unpause, use UnpauseAnim. | |
override void | PlayAnim (string name) |
Starts playing the specified animation Note: this doesn't resume from a pause, it completely restarts the animation. To unpause, use UnpauseAnim. | |
void | PlayAnimInReverse (UVAnimation_Multi anim) |
Like PlayAnim, but plays the animation in reverse. See PlayAnim. | |
override void | PlayAnimInReverse (int index) |
Like PlayAnim, but plays the animation in reverse. See PlayAnim. | |
override void | PlayAnimInReverse (string name) |
Like PlayAnim, but plays the animation in reverse. See PlayAnim. | |
void | DoAnim (int index) |
Plays the specified animation only if it is not already playing. | |
void | DoAnim (string name) |
Plays the specified animation only if it is not already playing. | |
void | DoAnim (UVAnimation_Multi anim) |
Plays the specified animation only if it is not already playing. | |
override void | StopAnim () |
Stops the current animation from playing and resets it to the beginning for playing again. The sprite then reverts to the static (non-animating default) image. | |
void | UnpauseAnim () |
Resumes an animation from where it left off previously. | |
UVAnimation_Multi | GetCurAnim () |
Returns a reference to the currently selected animation. NOTE: This does not mean the animation is currently playing. To determine whether the animation is playing, use IsAnimating. | |
UVAnimation_Multi | GetAnim (string name) |
Returns a reference to the animation that matches the name specified. | |
override int | GetStateIndex (string stateName) |
Returns the index of the state with the specified name. -1 if no state matching the specified name is found. | |
override void | SetState (int index) |
Sets the sprite to the specified state/animation. | |
void | SetLowerLeftPixel (Vector2 lowerLeft) |
Sets the lower-left pixel of the sprite. See lowerLeftPixel. | |
void | SetLowerLeftPixel (int x, int y) |
Sets the lower-left pixel of the sprite. See lowerLeftPixel. | |
void | SetPixelDimensions (Vector2 size) |
Sets the pixel dimensions of the sprite. See pixelDimensions. | |
void | SetPixelDimensions (int x, int y) |
Sets the pixel dimensions of the sprite. See pixelDimensions. | |
delegate void | AnimCompleteDelegate (SpriteBase sprite) |
delegate void | AnimFrameDelegate (SpriteBase sprite, int frame) |
override void | Delete () |
If non-managed, call Delete() before destroying this component or the GameObject to which it is attached. Memory leaks can ensue otherwise. | |
virtual void | Copy (SpriteRoot s) |
Copies all the vital attributes of another sprite. | |
override void | Hide (bool tf) |
Hides or displays the sprite by disabling/enabling the sprite's mesh renderer component, or if managed, sets the mesh size to 0. | |
void | SetAnimCompleteDelegate (AnimCompleteDelegate del) |
Sets the delegate to be called upon animation completion. | |
void | SetAnimFrameDelegate (AnimFrameDelegate del) |
Sets the delegate to be called each frame of animation. | |
void | SetSpriteResizedDelegate (SpriteResizedDelegate del) |
Sets the delegate to be called when the sprite is resized. | |
void | AddSpriteResizedDelegate (SpriteResizedDelegate del) |
Adds the delegate to be called when the sprite is resized. | |
void | RemoveSpriteresizedDelegate (SpriteResizedDelegate del) |
Removes the specified delegate from the list of those to be called when the sprite is resized. | |
void | SetFramerate (float fps) |
Changes the framerate at which the current animation plays. NOTE: This only has effect if called AFTER PlayAnim() is called. Otherwise, PlayAnim() sets the framerate to whatever is specified in the animation itself. | |
void | PauseAnim () |
Pauses the currently-playing animation. | |
void | RevertToStatic () |
Reverts the sprite to its static (non-animating) default appearance. | |
bool | IsAnimating () |
Returns whether the sprite is currently animating. | |
delegate void | SpriteResizedDelegate (float newWidth, float newHeight, SpriteRoot sprite) |
void | CalcSize () |
Recalculates the width and height of the sprite based upon the change in its UV dimensions (autoResize) or on the current camera's disposition (pixelPerfect). | |
virtual void | SetSize (float w, float h) |
Sets the physical dimensions of the sprite in the plane selected. | |
virtual void | TruncateRight (float pct) |
Truncates the right edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation. | |
virtual void | TruncateLeft (float pct) |
Truncates the left edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation. | |
virtual void | TruncateTop (float pct) |
Truncates the top edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation. | |
virtual void | TruncateBottom (float pct) |
Truncates the bottom edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation. | |
virtual void | Untruncate () |
Removes any truncation. | |
virtual void | Unclip () |
Removes any clipping that is being applied to the sprite. | |
virtual void | UpdateUVs () |
Applies any changes to the UVs to the actual sprite mesh. | |
virtual void | SetColor (Color c) |
Sets the sprite's color to the specified color. | |
void | CalcPixelToUV () |
Recalculates the pixel-to-UV ratio based on the current texture. | |
void | SetTexture (Texture2D tex) |
Changes the texture to be used by the sprite's material. NOTE: This will cause the sprite not to batch with other sprites and can only be used with non-managed sprites. | |
void | SetMaterial (Material mat) |
Changes the material to be used by the sprite. NOTE: This can only be used with non-managed sprites. | |
void | UpdateCamera () |
Updates any camera-dependent settings, such as the calculated pixel-perfect size. Use this with BroadcastMessage() to do bulk re-calculation of object sizes whenever your screensize/resolution changes at runtime. | |
void | SetCamera () |
A no-argument version of SetCamera() that simply re-assigns the same camera to the object, forcing it to recalculate all camera-dependent calculations. | |
virtual void | SetCamera (Camera c) |
Sets the camera to use when calculating a pixel-perfect sprite size. | |
bool | IsHidden () |
Returns whether the sprite is currently set to be hideAtStart (whether its mesh renderer component is enabled). | |
void | SetBleedCompensation (float x, float y) |
Sets the bleed compensation to use (see bleedCompensation). | |
void | SetBleedCompensation (Vector2 xy) |
Sets the bleed compensation to use (see bleedCompensation). | |
void | SetPlane (SPRITE_PLANE p) |
Sets the plane in which the sprite is to be drawn. See: SPRITE_PLANE. | |
void | SetWindingOrder (WINDING_ORDER order) |
Sets the winding order to use. See WINDING_ORDER. | |
void | SetDrawLayer (int layer) |
Sets the draw layer of the sprite (only applies to managed sprites). | |
void | SetFrameInfo (SPRITE_FRAME fInfo) |
Sets the sprite's frame info, which includes UVs, offsets, etc. | |
void | SetUVs (Rect uv) |
Sets the sprite's UVs to the specified values. | |
void | SetUVsFromPixelCoords (Rect pxCoords) |
Sets the sprite's UVs from pixel coordinates. | |
Rect | GetUVs () |
Returns the current UV coordinates of the sprite (before bleed compensation). | |
Vector3[] | GetVertices () |
Returns a reference to the sprite's vertices. NOTE: You can only directly modify the sprite's vertices if it is a non-managed sprite. | |
Vector3 | GetCenterPoint () |
Gets the center point of the sprite, taking into account the actual positions of vertices. | |
void | SetAnchor (ANCHOR_METHOD a) |
Sets the anchor method to use. See ANCHOR_METHOD. | |
void | SetOffset (Vector3 o) |
Sets the offset of the sprite from its GameObject. See offset. | |
Vector2 | PixelSpaceToUVSpace (Vector2 xy) |
Converts pixel-space values to UV-space scalar values according to the currently assigned material. NOTE: This is for converting widths and heights-not coordinates (which have reversed Y-coordinates). For coordinates, use PixelCoordToUVCoord()! | |
Vector2 | PixelSpaceToUVSpace (int x, int y) |
Converts pixel-space values to UV-space scalar values according to the currently assigned material. NOTE: This is for converting widths and heights-not coordinates (which have reversed Y-coordinates). For coordinates, use PixelCoordToUVCoord()! | |
Vector2 | PixelCoordToUVCoord (Vector2 xy) |
Converts pixel coordinates to UV coordinates according to the currently assigned material. NOTE: This is for converting coordinates and will reverse the Y component accordingly. For converting widths and heights, use PixelSpaceToUVSpace()! | |
Vector2 | PixelCoordToUVCoord (int x, int y) |
Converts pixel coordinates to UV coordinates according to the currently assigned material. NOTE: This is for converting coordinates and will reverse the Y component accordingly. For converting widths and heights, use PixelSpaceToUVSpace()! | |
Static Public Member Functions | |
static Sprite | Create (string name, Vector3 pos) |
Creates a GameObject and attaches this component type to it. | |
static Sprite | Create (string name, Vector3 pos, Quaternion rotation) |
Creates a GameObject and attaches this component type to it. | |
Public Attributes | |
Vector2 | lowerLeftPixel |
Position of the lower-left pixel of the sprite when no animation has been played. | |
Vector2 | pixelDimensions |
Dimensions, in pixels, of the sprite when no animation has been played. | |
UVAnimation_Multi[] | animations |
Array of available animation sequences. This is typically built in-editor. | |
bool | playAnimOnStart = false |
When set to true, the sprite will play the default animation (see defaultAnim) when the sprite is instantiated. | |
int | defaultAnim = 0 |
Index of the animation to play by default. | |
bool | managed = false |
When true, the sprite will be managed by the selected sprite manager script. When false, the sprite has its own mesh and will be batched automatically with other sprites (when available - Unity iPhone). | |
SpriteManager | manager |
Reference to the manager which will manage this sprite, provided managed is set to true. | |
int | drawLayer |
The layer in which the sprite will be drawn if managed. | |
bool | persistent = false |
This must be set to true at design time for the sprite to survive loading a new level. | |
SPRITE_PLANE | plane = SPRITE_PLANE.XY |
The plane in which the sprite will be drawn. | |
WINDING_ORDER | winding = WINDING_ORDER.CW |
The winding order of the sprite's polygons - determines the direction the sprite will "face". | |
float | width |
Width of the sprite in world space. | |
float | height |
Height of the sprite in world space. | |
Vector2 | bleedCompensation |
Will contract the UV edges of the sprite by the specified amount to prevent "bleeding" from neighboring pixels, especially when mipmapping. | |
ANCHOR_METHOD | anchor = ANCHOR_METHOD.TEXTURE_OFFSET |
Anchor method to use.
| |
bool | pixelPerfect = false |
Automatically sizes the sprite so that it will display pixel-perfect on-screen. NOTE: If you change the orthographic size of the camera or the distance between the sprite and a perspective camera, call SetCamera() to make the text pixel-perfect again. However, if you want automatic resizing functionality without being pixel-perfect and therefore allowing zooming in and out, use autoResize instead. | |
bool | autoResize = false |
Automatically resizes the sprite based on its new UV dimensions compared to its previous dimensions. Setting this to true allows you to use non-uniform sized sprites for animation without causing the sprite to appear "squashed" while animating. | |
Vector3 | offset = new Vector3() |
Offsets the sprite, in world space, from the center of its GameObject. | |
Color | color = Color.white |
The color to be used by all four of the sprite's vertices. This can be used to color, highlight, or fade the sprite. Be sure to use a vertex-colored shader for this to have an effect. | |
bool | hideAtStart = false |
Whether the sprite will be hideAtStart when it starts. | |
bool | ignoreClipping = false |
When true, the sprite will not be clipped. | |
Properties | |
bool | Animating [get, set] |
Property useful for use with EZ Game Saver. When it gets set, the current animation is started. Include this, along with CurAnimIndex, as a saved property so that any playing animation is resumed. | |
int | CurAnimIndex [get, set] |
Property useful for use with EZ Game Saver. Include this as a saved property, along with Animating, so that any playing animation is resumed. | |
Color | Color [get, set] |
Accessor for the object's current overall color tint. | |
virtual Camera | RenderCamera [get, set] |
Accessor for the camera that will be used to render this object. Use this to ensure the object is properly configured for the specific camera that will render it. | |
Vector2 | PixelSize [get, set] |
Gets/Sets the width and height of the sprite in pixels as it appears on-screen. | |
Vector2 | ImageSize [get] |
Gets the width and height of the image the sprite is displaying. NOTE: This is not the number of screen pixels occupied by the sprite, but rather the original number of texels which compose the sprite's image. | |
bool | Managed [get, set] |
Sets the sprite to a managed or batched state. | |
virtual Rect3D | ClippingRect [get, set] |
The rect against which the sprite should be clipped. The sprite will be immediately clipped by this rect when set. When setting, the rect should be in world space. | |
virtual bool | Clipped [get, set] |
Accessor for whether the sprite is to be clipped by any already-specified clipping rect. | |
ANCHOR_METHOD | Anchor [get, set] |
Accessor for the object's anchor method. | |
Vector3 | UnclippedTopLeft [get] |
The top-left corner of the sprite when no clipping or trimming is applied. | |
Vector3 | UnclippedBottomRight [get] |
The bottom-right corner of the sprite when no clipping or trimming is applied. | |
Vector3 | TopLeft [get] |
Returns the position of the top-left vertex of the sprite after any clipping or trimming. | |
Vector3 | BottomRight [get] |
Returns the position of the bottom-right vertex of the sprite after any clipping or trimming. |
Implements SpriteBase and adds certain animation functionality specific to this type of sprite.
enum SpriteRoot::ANCHOR_METHOD [inherited] |
The anchoring scheme of a sprite. The anchor point is the point on the sprite that will remain stationary when the sprite's size changes. For a health bar that "grows" to the right while its left edge remains stationary, you would use UPPER_LEFT, MIDDLE_LEFT, or BOTTOM_LEFT.
For a health bar that "grows" upward while the bottom edge remains stationary, you would use BOTTOM_LEFT, BOTTOM_CENTER, or BOTTOM_RIGHT.
enum SpriteRoot::SPRITE_PLANE [inherited] |
The plane in which a sprite should be drawn.
enum SpriteRoot::WINDING_ORDER [inherited] |
Defines which way the polygons of a sprite should be wound. The two options are clock-wise (CW) and counter clock-wise (CCW). These determine the direction the sprite will "face".
void Sprite.AddAnimation | ( | UVAnimation_Multi | anim | ) |
Adds an animation to the sprite for its use.
anim | The animation to add |
void SpriteBase.AddSpriteResizedDelegate | ( | SpriteResizedDelegate | del | ) | [inherited] |
Adds the delegate to be called when the sprite is resized.
del | A delegate to be called when the sprite is resized. |
delegate void SpriteBase.AnimCompleteDelegate | ( | SpriteBase | sprite | ) | [inherited] |
Defines a delegate that can be called upon animation completion. Use this if you want something to happen as soon as an animation reaches the end. Receives a reference to the sprite.
sprite | A reference to the sprite whose animation has finished. |
delegate void SpriteBase.AnimFrameDelegate | ( | SpriteBase | sprite, | |
int | frame | |||
) | [inherited] |
Defines a delegate that can be called once for each frame of animation. Use this if you want something to happen on an animation frame. Receives a reference to the sprite and the zero-based index of the current frame as an argument.
sprite | A reference to the sprite which is calling the delegate. | |
frame | The current animation frame number. (0-based) |
void SpriteRoot.CalcPixelToUV | ( | ) | [inherited] |
Recalculates the pixel-to-UV ratio based on the current texture.
void SpriteRoot.CalcSize | ( | ) | [inherited] |
Recalculates the width and height of the sprite based upon the change in its UV dimensions (autoResize) or on the current camera's disposition (pixelPerfect).
override void Sprite.Clear | ( | ) | [virtual] |
Resets important sprite values to defaults for reuse.
Reimplemented from SpriteBase.
virtual void SpriteRoot.Copy | ( | SpriteRoot | s | ) | [virtual, inherited] |
Copies all the vital attributes of another sprite.
s | Source sprite to be copied. |
override void Sprite.Copy | ( | SpriteRoot | s | ) |
Copies all the attributes of another sprite.
s | A reference to the sprite to be copied. |
Reimplemented from SpriteBase.
static Sprite Sprite.Create | ( | string | name, | |
Vector3 | pos, | |||
Quaternion | rotation | |||
) | [static] |
Creates a GameObject and attaches this component type to it.
name | Name to give to the new GameObject. | |
pos | Position, in world space, where the new object should be created. | |
rotation | Rotation of the object. |
static Sprite Sprite.Create | ( | string | name, | |
Vector3 | pos | |||
) | [static] |
Creates a GameObject and attaches this component type to it.
name | Name to give to the new GameObject. | |
pos | Position, in world space, where the new object should be created. |
override void SpriteBase.Delete | ( | ) | [virtual, inherited] |
If non-managed, call Delete() before destroying this component or the GameObject to which it is attached. Memory leaks can ensue otherwise.
Reimplemented from SpriteRoot.
void Sprite.DoAnim | ( | UVAnimation_Multi | anim | ) |
Plays the specified animation only if it is not already playing.
anim | Reference to the animation to play. |
void Sprite.DoAnim | ( | string | name | ) |
Plays the specified animation only if it is not already playing.
name | Name of the animation to play. |
void Sprite.DoAnim | ( | int | index | ) |
Plays the specified animation only if it is not already playing.
index | Index of the animation to play. |
UVAnimation_Multi Sprite.GetAnim | ( | string | name | ) |
Returns a reference to the animation that matches the name specified.
name | Name of the animation sought. |
Vector3 SpriteRoot.GetCenterPoint | ( | ) | [inherited] |
Gets the center point of the sprite, taking into account the actual positions of vertices.
UVAnimation_Multi Sprite.GetCurAnim | ( | ) |
Returns a reference to the currently selected animation. NOTE: This does not mean the animation is currently playing. To determine whether the animation is playing, use IsAnimating.
override int Sprite.GetStateIndex | ( | string | stateName | ) | [virtual] |
Returns the index of the state with the specified name. -1 if no state matching the specified name is found.
stateName | The name of the state sought. |
Implements SpriteRoot.
Rect SpriteRoot.GetUVs | ( | ) | [inherited] |
Returns the current UV coordinates of the sprite (before bleed compensation).
Vector3 [] SpriteRoot.GetVertices | ( | ) | [inherited] |
Returns a reference to the sprite's vertices. NOTE: You can only directly modify the sprite's vertices if it is a non-managed sprite.
override void SpriteBase.Hide | ( | bool | tf | ) | [virtual, inherited] |
Hides or displays the sprite by disabling/enabling the sprite's mesh renderer component, or if managed, sets the mesh size to 0.
tf | When true, the sprite is hideAtStart, when false, the sprite will be displayed. |
Reimplemented from SpriteRoot.
Reimplemented in UIListItem, UIProgressBar, UISlider, UITextField, and AutoSpriteControlBase.
bool SpriteBase.IsAnimating | ( | ) | [inherited] |
Returns whether the sprite is currently animating.
bool SpriteRoot.IsHidden | ( | ) | [inherited] |
Returns whether the sprite is currently set to be hideAtStart (whether its mesh renderer component is enabled).
void SpriteBase.PauseAnim | ( | ) | [inherited] |
Pauses the currently-playing animation.
Vector2 SpriteRoot.PixelCoordToUVCoord | ( | int | x, | |
int | y | |||
) | [inherited] |
Converts pixel coordinates to UV coordinates according to the currently assigned material. NOTE: This is for converting coordinates and will reverse the Y component accordingly. For converting widths and heights, use PixelSpaceToUVSpace()!
x | The x-coordinate to convert. | |
y | The y-coordinate to convert. |
Vector2 SpriteRoot.PixelCoordToUVCoord | ( | Vector2 | xy | ) | [inherited] |
Converts pixel coordinates to UV coordinates according to the currently assigned material. NOTE: This is for converting coordinates and will reverse the Y component accordingly. For converting widths and heights, use PixelSpaceToUVSpace()!
xy | The coordinates to convert. |
Vector2 SpriteRoot.PixelSpaceToUVSpace | ( | int | x, | |
int | y | |||
) | [inherited] |
Converts pixel-space values to UV-space scalar values according to the currently assigned material. NOTE: This is for converting widths and heights-not coordinates (which have reversed Y-coordinates). For coordinates, use PixelCoordToUVCoord()!
x | The X-value to convert. | |
y | The Y-value to convert. |
Vector2 SpriteRoot.PixelSpaceToUVSpace | ( | Vector2 | xy | ) | [inherited] |
Converts pixel-space values to UV-space scalar values according to the currently assigned material. NOTE: This is for converting widths and heights-not coordinates (which have reversed Y-coordinates). For coordinates, use PixelCoordToUVCoord()!
xy | The values to convert. |
override void Sprite.PlayAnim | ( | string | name | ) | [virtual] |
Starts playing the specified animation Note: this doesn't resume from a pause, it completely restarts the animation. To unpause, use UnpauseAnim.
name | The name of the animation to play. |
Reimplemented from SpriteBase.
override void Sprite.PlayAnim | ( | int | index | ) | [virtual] |
Starts playing the specified animation Note: this doesn't resume from a pause, it completely restarts the animation. To unpause, use UnpauseAnim.
index | Index of the animation to play. |
Reimplemented from SpriteBase.
void Sprite.PlayAnim | ( | UVAnimation_Multi | anim | ) |
Starts playing the specified animation Note: this doesn't resume from a pause, it completely restarts the animation. To unpause, use UnpauseAnim.
anim | A reference to the animation to play. |
override void Sprite.PlayAnimInReverse | ( | string | name | ) | [virtual] |
Like PlayAnim, but plays the animation in reverse. See PlayAnim.
name | Name of the animation to play in reverse. |
Reimplemented from SpriteBase.
override void Sprite.PlayAnimInReverse | ( | int | index | ) | [virtual] |
Like PlayAnim, but plays the animation in reverse. See PlayAnim.
index | Index of the animation to play in reverse. |
Reimplemented from SpriteBase.
void Sprite.PlayAnimInReverse | ( | UVAnimation_Multi | anim | ) |
Like PlayAnim, but plays the animation in reverse. See PlayAnim.
anim | Reference to the animation to play in reverse. |
void SpriteBase.RemoveSpriteresizedDelegate | ( | SpriteResizedDelegate | del | ) | [inherited] |
Removes the specified delegate from the list of those to be called when the sprite is resized.
del | The delegate to be removed. |
void SpriteBase.RevertToStatic | ( | ) | [inherited] |
Reverts the sprite to its static (non-animating) default appearance.
void SpriteRoot.SetAnchor | ( | ANCHOR_METHOD | a | ) | [inherited] |
Sets the anchor method to use. See ANCHOR_METHOD.
a | The anchor method to use. |
void SpriteBase.SetAnimCompleteDelegate | ( | AnimCompleteDelegate | del | ) | [inherited] |
Sets the delegate to be called upon animation completion.
del | The delegate to be called when an animation finishes playing. |
void SpriteBase.SetAnimFrameDelegate | ( | AnimFrameDelegate | del | ) | [inherited] |
Sets the delegate to be called each frame of animation.
del | The delegate to be called each frame of animation. |
void SpriteRoot.SetBleedCompensation | ( | Vector2 | xy | ) | [inherited] |
Sets the bleed compensation to use (see bleedCompensation).
void SpriteRoot.SetBleedCompensation | ( | float | x, | |
float | y | |||
) | [inherited] |
Sets the bleed compensation to use (see bleedCompensation).
virtual void SpriteRoot.SetCamera | ( | Camera | c | ) | [virtual, inherited] |
Sets the camera to use when calculating a pixel-perfect sprite size.
c |
Reimplemented in AutoSpriteControlBase.
void SpriteRoot.SetCamera | ( | ) | [inherited] |
A no-argument version of SetCamera() that simply re-assigns the same camera to the object, forcing it to recalculate all camera-dependent calculations.
virtual void SpriteRoot.SetColor | ( | Color | c | ) | [virtual, inherited] |
Sets the sprite's color to the specified color.
c | Color to shade the sprite. |
Reimplemented in UIProgressBar, and UISlider.
void SpriteRoot.SetDrawLayer | ( | int | layer | ) | [inherited] |
Sets the draw layer of the sprite (only applies to managed sprites).
layer | The draw layer of the sprite. Lower values cause an earlier draw order, higher values, a later draw order. |
void SpriteRoot.SetFrameInfo | ( | SPRITE_FRAME | fInfo | ) | [inherited] |
Sets the sprite's frame info, which includes UVs, offsets, etc.
fInfo | A SPRITE_FRAME structure containing the frame info. |
void SpriteBase.SetFramerate | ( | float | fps | ) | [inherited] |
Changes the framerate at which the current animation plays. NOTE: This only has effect if called AFTER PlayAnim() is called. Otherwise, PlayAnim() sets the framerate to whatever is specified in the animation itself.
fps | The new framerate, in frames per second. |
void Sprite.SetLowerLeftPixel | ( | int | x, | |
int | y | |||
) |
Sets the lower-left pixel of the sprite. See lowerLeftPixel.
x | X pixel coordinate. | |
y | Y pixel coordinate. |
void Sprite.SetLowerLeftPixel | ( | Vector2 | lowerLeft | ) |
Sets the lower-left pixel of the sprite. See lowerLeftPixel.
lowerLeft | Pixel coordinate of the lower-left corner of the sprite. |
void SpriteRoot.SetMaterial | ( | Material | mat | ) | [inherited] |
Changes the material to be used by the sprite. NOTE: This can only be used with non-managed sprites.
mat | The new material. |
void SpriteRoot.SetOffset | ( | Vector3 | o | ) | [inherited] |
Sets the offset of the sprite from its GameObject. See offset.
o | The offset to use. |
void Sprite.SetPixelDimensions | ( | int | x, | |
int | y | |||
) |
Sets the pixel dimensions of the sprite. See pixelDimensions.
x | X size in pixels. | |
y | Y size in pixels. |
void Sprite.SetPixelDimensions | ( | Vector2 | size | ) |
Sets the pixel dimensions of the sprite. See pixelDimensions.
size | Dimensions of the sprite in pixels. |
void SpriteRoot.SetPlane | ( | SPRITE_PLANE | p | ) | [inherited] |
Sets the plane in which the sprite is to be drawn. See: SPRITE_PLANE.
p | The plane in which the sprite should be drawn. |
virtual void SpriteRoot.SetSize | ( | float | w, | |
float | h | |||
) | [virtual, inherited] |
Sets the physical dimensions of the sprite in the plane selected.
width | Width of the sprite in world space. | |
height | Height of the sprite in world space. |
Reimplemented in UIProgressBar, and UISlider.
void SpriteBase.SetSpriteResizedDelegate | ( | SpriteResizedDelegate | del | ) | [inherited] |
Sets the delegate to be called when the sprite is resized.
del | The delegate to be called when the sprite is resized. |
override void Sprite.SetState | ( | int | index | ) | [virtual] |
Sets the sprite to the specified state/animation.
index | The zero-based index of the desired state/animation. |
Implements SpriteRoot.
void SpriteRoot.SetTexture | ( | Texture2D | tex | ) | [inherited] |
Changes the texture to be used by the sprite's material. NOTE: This will cause the sprite not to batch with other sprites and can only be used with non-managed sprites.
tex | The new texture. |
void Sprite.Setup | ( | float | w, | |
float | h, | |||
Vector2 | lowerleftPixel, | |||
Vector2 | pixeldimensions, | |||
Material | material | |||
) |
Sets up the essential elements of a sprite.
w | The width, in local space, of the sprite. | |
h | The height, in local space, of the sprite. | |
lowerleftPixel | The coordinate of the lower-left pixel of the desired sprite on the sprite atlas. | |
pixeldimensions | The X and Y dimensions, in pixels, of the sprite. | |
material | The material to use for the sprite. |
void Sprite.Setup | ( | float | w, | |
float | h, | |||
Vector2 | lowerleftPixel, | |||
Vector2 | pixeldimensions | |||
) |
Sets up the essential elements of a sprite.
w | The width, in local space, of the sprite. | |
h | The height, in local space, of the sprite. | |
lowerleftPixel | The coordinate of the lower-left pixel of the desired sprite on the sprite atlas. | |
pixeldimensions | The X and Y dimensions, in pixels, of the sprite. |
void SpriteRoot.SetUVs | ( | Rect | uv | ) | [inherited] |
Sets the sprite's UVs to the specified values.
nextFrame | A Rect containing the new UV coordinates. |
void SpriteRoot.SetUVsFromPixelCoords | ( | Rect | pxCoords | ) | [inherited] |
Sets the sprite's UVs from pixel coordinates.
pxCoords | A rect containing the pixel coordinates. When populating the Rect, use the following syntax: Rect.MinMaxRect(leftCoord, bottomCoord, rightCoord, topCoord) Where the coordinates are in pixel space. Like in any image editor, the coordinate space runs from 0 on the left to width-1 on the right, and 0 at the top, to height-1 at the bottom. |
void SpriteRoot.SetWindingOrder | ( | WINDING_ORDER | order | ) | [inherited] |
Sets the winding order to use. See WINDING_ORDER.
order | The winding order to use. |
delegate void SpriteRoot.SpriteResizedDelegate | ( | float | newWidth, | |
float | newHeight, | |||
SpriteRoot | sprite | |||
) | [inherited] |
Defines a delegate that can be called upon resizing of the sprite. Use this if you want to adjust colliders, etc, when the sprites dimensions are resized.
override void Sprite.StopAnim | ( | ) | [virtual] |
Stops the current animation from playing and resets it to the beginning for playing again. The sprite then reverts to the static (non-animating default) image.
Reimplemented from SpriteBase.
virtual void SpriteRoot.TruncateBottom | ( | float | pct | ) | [virtual, inherited] |
Truncates the bottom edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation.
pct | The percentage of the sprite to truncate (0-1) |
Reimplemented in UIListItem, and AutoSpriteControlBase.
virtual void SpriteRoot.TruncateLeft | ( | float | pct | ) | [virtual, inherited] |
Truncates the left edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation.
pct | The percentage of the sprite to truncate (0-1) |
Reimplemented in UIListItem, and AutoSpriteControlBase.
virtual void SpriteRoot.TruncateRight | ( | float | pct | ) | [virtual, inherited] |
Truncates the right edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation.
pct | The percentage of the sprite to truncate (0-1) |
Reimplemented in UIListItem, and AutoSpriteControlBase.
virtual void SpriteRoot.TruncateTop | ( | float | pct | ) | [virtual, inherited] |
Truncates the top edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation.
pct | The percentage of the sprite to truncate (0-1) |
Reimplemented in UIListItem, and AutoSpriteControlBase.
virtual void SpriteRoot.Unclip | ( | ) | [virtual, inherited] |
Removes any clipping that is being applied to the sprite.
Reimplemented in UIProgressBar, UISlider, UITextField, and AutoSpriteControlBase.
void Sprite.UnpauseAnim | ( | ) |
Resumes an animation from where it left off previously.
virtual void SpriteRoot.Untruncate | ( | ) | [virtual, inherited] |
Removes any truncation.
Reimplemented in UIListItem, and AutoSpriteControlBase.
void SpriteRoot.UpdateCamera | ( | ) | [inherited] |
Updates any camera-dependent settings, such as the calculated pixel-perfect size. Use this with BroadcastMessage() to do bulk re-calculation of object sizes whenever your screensize/resolution changes at runtime.
virtual void SpriteRoot.UpdateUVs | ( | ) | [virtual, inherited] |
Applies any changes to the UVs to the actual sprite mesh.
ANCHOR_METHOD SpriteRoot.anchor = ANCHOR_METHOD.TEXTURE_OFFSET [inherited] |
Array of available animation sequences. This is typically built in-editor.
bool SpriteRoot.autoResize = false [inherited] |
Automatically resizes the sprite based on its new UV dimensions compared to its previous dimensions. Setting this to true allows you to use non-uniform sized sprites for animation without causing the sprite to appear "squashed" while animating.
Vector2 SpriteRoot.bleedCompensation [inherited] |
Will contract the UV edges of the sprite by the specified amount to prevent "bleeding" from neighboring pixels, especially when mipmapping.
Color SpriteRoot.color = Color.white [inherited] |
The color to be used by all four of the sprite's vertices. This can be used to color, highlight, or fade the sprite. Be sure to use a vertex-colored shader for this to have an effect.
int SpriteBase.defaultAnim = 0 [inherited] |
Index of the animation to play by default.
int SpriteRoot.drawLayer [inherited] |
The layer in which the sprite will be drawn if managed.
float SpriteRoot.height [inherited] |
Height of the sprite in world space.
bool SpriteRoot.hideAtStart = false [inherited] |
Whether the sprite will be hideAtStart when it starts.
bool SpriteRoot.ignoreClipping = false [inherited] |
When true, the sprite will not be clipped.
Vector2 Sprite.lowerLeftPixel |
Position of the lower-left pixel of the sprite when no animation has been played.
bool SpriteRoot.managed = false [inherited] |
When true, the sprite will be managed by the selected sprite manager script. When false, the sprite has its own mesh and will be batched automatically with other sprites (when available - Unity iPhone).
SpriteManager SpriteRoot.manager [inherited] |
Reference to the manager which will manage this sprite, provided managed is set to true.
Vector3 SpriteRoot.offset = new Vector3() [inherited] |
Offsets the sprite, in world space, from the center of its GameObject.
bool SpriteRoot.persistent = false [inherited] |
This must be set to true at design time for the sprite to survive loading a new level.
Vector2 Sprite.pixelDimensions |
Dimensions, in pixels, of the sprite when no animation has been played.
bool SpriteRoot.pixelPerfect = false [inherited] |
Automatically sizes the sprite so that it will display pixel-perfect on-screen. NOTE: If you change the orthographic size of the camera or the distance between the sprite and a perspective camera, call SetCamera() to make the text pixel-perfect again. However, if you want automatic resizing functionality without being pixel-perfect and therefore allowing zooming in and out, use autoResize instead.
SPRITE_PLANE SpriteRoot.plane = SPRITE_PLANE.XY [inherited] |
The plane in which the sprite will be drawn.
bool SpriteBase.playAnimOnStart = false [inherited] |
When set to true, the sprite will play the default animation (see defaultAnim) when the sprite is instantiated.
float SpriteRoot.width [inherited] |
Width of the sprite in world space.
WINDING_ORDER SpriteRoot.winding = WINDING_ORDER.CW [inherited] |
The winding order of the sprite's polygons - determines the direction the sprite will "face".
ANCHOR_METHOD SpriteRoot.Anchor [get, set, inherited] |
Accessor for the object's anchor method.
bool SpriteBase.Animating [get, set, inherited] |
Property useful for use with EZ Game Saver. When it gets set, the current animation is started. Include this, along with CurAnimIndex, as a saved property so that any playing animation is resumed.
Vector3 SpriteRoot.BottomRight [get, inherited] |
Returns the position of the bottom-right vertex of the sprite after any clipping or trimming.
virtual bool SpriteRoot.Clipped [get, set, inherited] |
Accessor for whether the sprite is to be clipped by any already-specified clipping rect.
Reimplemented in UIProgressBar, UISlider, UITextField, and AutoSpriteControlBase.
virtual Rect3D SpriteRoot.ClippingRect [get, set, inherited] |
The rect against which the sprite should be clipped. The sprite will be immediately clipped by this rect when set. When setting, the rect should be in world space.
Reimplemented in UIProgressBar, UISlider, UITextField, and AutoSpriteControlBase.
Color SpriteRoot.Color [get, set, inherited] |
Accessor for the object's current overall color tint.
int SpriteBase.CurAnimIndex [get, set, inherited] |
Property useful for use with EZ Game Saver. Include this as a saved property, along with Animating, so that any playing animation is resumed.
Vector2 SpriteRoot.ImageSize [get, inherited] |
Gets the width and height of the image the sprite is displaying. NOTE: This is not the number of screen pixels occupied by the sprite, but rather the original number of texels which compose the sprite's image.
bool SpriteRoot.Managed [get, set, inherited] |
Sets the sprite to a managed or batched state.
Vector2 SpriteRoot.PixelSize [get, set, inherited] |
Gets/Sets the width and height of the sprite in pixels as it appears on-screen.
virtual Camera SpriteRoot.RenderCamera [get, set, inherited] |
Accessor for the camera that will be used to render this object. Use this to ensure the object is properly configured for the specific camera that will render it.
Reimplemented in AutoSpriteControlBase.
Vector3 SpriteRoot.TopLeft [get, inherited] |
Returns the position of the top-left vertex of the sprite after any clipping or trimming.
Vector3 SpriteRoot.UnclippedBottomRight [get, inherited] |
The bottom-right corner of the sprite when no clipping or trimming is applied.
Vector3 SpriteRoot.UnclippedTopLeft [get, inherited] |
The top-left corner of the sprite when no clipping or trimming is applied.