SpriteManager 2
 All Classes Functions Variables Enumerations Enumerator Properties
SpriteBase Class Referenceabstract
Inheritance diagram for SpriteBase:
SpriteRoot IEZLinkedListItem< T > AutoSpriteBase ManualSprite PackedSprite

Public Types

enum  SPRITE_PLANE
 
enum  ANCHOR_METHOD
 
enum  WINDING_ORDER
 

Public Member Functions

delegate void AnimCompleteDelegate (SpriteBase sprite)
 
delegate void AnimFrameDelegate (SpriteBase sprite, int frame)
 
override void Clear ()
 Resets important sprite values to defaults for reuse. More...
 
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. More...
 
override void Copy (SpriteRoot s)
 Copies all the vital attributes of another sprite. More...
 
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. More...
 
void SetAnimCompleteDelegate (AnimCompleteDelegate del)
 Sets the delegate to be called upon animation completion. More...
 
void SetAnimFrameDelegate (AnimFrameDelegate del)
 Sets the delegate to be called each frame of animation. More...
 
void SetSpriteResizedDelegate (SpriteResizedDelegate del)
 Sets the delegate to be called when the sprite is resized. More...
 
void AddSpriteResizedDelegate (SpriteResizedDelegate del)
 Adds the delegate to be called when the sprite is resized. More...
 
void RemoveSpriteresizedDelegate (SpriteResizedDelegate del)
 Removes the specified delegate from the list of those to be called when the sprite is resized. More...
 
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. More...
 
void PauseAnim ()
 Pauses the currently-playing animation. More...
 
virtual void StopAnim ()
 Stops the current animation from playing and resets it to the beginning for playing again. The sprite then reverts to the static image. More...
 
void RevertToStatic ()
 Reverts the sprite to its static (non-animating) default appearance. More...
 
bool IsAnimating ()
 Returns whether the sprite is currently animating. More...
 
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). More...
 
virtual void SetSize (float w, float h)
 Sets the physical dimensions of the sprite in the plane selected More...
 
virtual void TruncateRight (float pct)
 Truncates the right edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation More...
 
virtual void TruncateLeft (float pct)
 Truncates the left edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation More...
 
virtual void TruncateTop (float pct)
 Truncates the top edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation More...
 
virtual void TruncateBottom (float pct)
 Truncates the bottom edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation More...
 
virtual void Untruncate ()
 Removes any truncation. More...
 
virtual void Unclip ()
 Removes any clipping that is being applied to the sprite. More...
 
virtual void UpdateUVs ()
 Applies any changes to the UVs to the actual sprite mesh. More...
 
virtual void SetColor (Color c)
 Sets the sprite's color to the specified color. More...
 
void CalcPixelToUV ()
 Recalculates the pixel-to-UV ratio based on the current texture. More...
 
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. More...
 
void SetMaterial (Material mat)
 Changes the material to be used by the sprite. NOTE: This can only be used with non-managed sprites. More...
 
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. More...
 
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. More...
 
virtual void SetCamera (Camera c)
 Sets the camera to use when calculating a pixel-perfect sprite size. More...
 
bool IsHidden ()
 Returns whether the sprite is currently set to be hideAtStart (whether its mesh renderer component is enabled). More...
 
void SetBleedCompensation (float x, float y)
 Sets the bleed compensation to use (see bleedCompensation). More...
 
void SetBleedCompensation (Vector2 xy)
 Sets the bleed compensation to use (see bleedCompensation). More...
 
void SetPlane (SPRITE_PLANE p)
 Sets the plane in which the sprite is to be drawn. See: SPRITE_PLANE More...
 
void SetWindingOrder (WINDING_ORDER order)
 Sets the winding order to use. See WINDING_ORDER. More...
 
void SetDrawLayer (int layer)
 Sets the draw layer of the sprite (only applies to managed sprites). More...
 
void SetFrameInfo (SPRITE_FRAME fInfo)
 Sets the sprite's frame info, which includes UVs, offsets, etc. More...
 
void SetUVs (Rect uv)
 Sets the sprite's UVs to the specified values. More...
 
void SetUVsFromPixelCoords (Rect pxCoords)
 Sets the sprite's UVs from pixel coordinates. More...
 
Rect GetUVs ()
 Returns the current UV coordinates of the sprite (before bleed compensation). More...
 
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. More...
 
Vector3 GetCenterPoint ()
 Gets the center point of the sprite, taking into account the actual positions of vertices. More...
 
void SetAnchor (ANCHOR_METHOD a)
 Sets the anchor method to use. See ANCHOR_METHOD More...
 
void SetOffset (Vector3 o)
 Sets the offset of the sprite from its GameObject. See offset More...
 
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()! More...
 
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()! More...
 
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()! More...
 
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()! More...
 
abstract int GetStateIndex (string stateName)
 Returns the index of the state with the specified name. -1 if no state matching the specified name is found. More...
 
abstract void SetState (int index)
 Sets the sprite to the specified state/animation. More...
 

Public Attributes

bool playAnimOnStart = false
 When set to true, the sprite will play the default animation (see defaultAnim) when the sprite is instantiated. More...
 
int defaultAnim = 0
 Index of the animation to play by default. More...
 
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). More...
 
SpriteManager manager
 Reference to the manager which will manage this sprite, provided managed is set to true. More...
 
int drawLayer
 The layer in which the sprite will be drawn if managed. More...
 
bool persistent = false
 This must be set to true at design time for the sprite to survive loading a new level. More...
 
SPRITE_PLANE plane = SPRITE_PLANE.XY
 The plane in which the sprite will be drawn. More...
 
WINDING_ORDER winding = WINDING_ORDER.CW
 The winding order of the sprite's polygons - determines the direction the sprite will "face". More...
 
float width
 Width of the sprite in world space. More...
 
float height
 Height of the sprite in world space. More...
 
Vector2 bleedCompensation
 Will contract the UV edges of the sprite by the specified amount to prevent "bleeding" from neighboring pixels, especially when mipmapping. More...
 
ANCHOR_METHOD anchor = ANCHOR_METHOD.TEXTURE_OFFSET
 Anchor method to use.

See Also
ANCHOR_METHOD
More...
 
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. More...
 
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. More...
 
Vector3 offset = new Vector3()
 Offsets the sprite, in world space, from the center of its GameObject. More...
 
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. More...
 
bool hideAtStart = false
 Whether the sprite will be hideAtStart when it starts. More...
 
bool ignoreClipping = false
 When true, the sprite will not be clipped. More...
 

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. More...
 
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. More...
 
Color Color [get, set]
 Accessor for the object's current overall color tint. More...
 
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. More...
 
Vector2 PixelSize [get, set]
 Gets/Sets the width and height of the sprite in pixels as it appears on-screen. More...
 
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. More...
 
bool Managed [get, set]
 Sets the sprite to a managed or batched state. More...
 
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. More...
 
virtual bool Clipped [get, set]
 Accessor for whether the sprite is to be clipped by any already-specified clipping rect. More...
 
ANCHOR_METHOD Anchor [get, set]
 Accessor for the object's anchor method. More...
 
Vector3 UnclippedTopLeft [get]
 The top-left corner of the sprite when no clipping or trimming is applied. More...
 
Vector3 UnclippedBottomRight [get]
 The bottom-right corner of the sprite when no clipping or trimming is applied. More...
 
Vector3 TopLeft [get]
 Returns the position of the top-left vertex of the sprite after any clipping or trimming. More...
 
Vector3 BottomRight [get]
 Returns the position of the bottom-right vertex of the sprite after any clipping or trimming. More...
 

Detailed Description

Serves as the base for defining an animatable sprite. This class should not actually be used despite the fact that Unity will allow you to attach it to a GameObject.

Definition at line 1257 of file SpriteBase.cs.

Member Enumeration Documentation

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.

Definition at line 651 of file SpriteRoot.cs.

enum SpriteRoot.SPRITE_PLANE
inherited

The plane in which a sprite should be drawn.

Definition at line 633 of file SpriteRoot.cs.

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".

Definition at line 673 of file SpriteRoot.cs.

Member Function Documentation

void SpriteBase.AddSpriteResizedDelegate ( SpriteResizedDelegate  del)

Adds the delegate to be called when the sprite is resized.

Parameters
delA delegate to be called when the sprite is resized.

Definition at line 1475 of file SpriteBase.cs.

delegate void SpriteBase.AnimCompleteDelegate ( SpriteBase  sprite)

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.

Parameters
spriteA reference to the sprite whose animation has finished.
delegate void SpriteBase.AnimFrameDelegate ( SpriteBase  sprite,
int  frame 
)

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.

Parameters
spriteA reference to the sprite which is calling the delegate.
frameThe current animation frame number. (0-based)
void SpriteRoot.CalcPixelToUV ( )
inherited

Recalculates the pixel-to-UV ratio based on the current texture.

Definition at line 1775 of file SpriteRoot.cs.

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

Definition at line 1350 of file SpriteRoot.cs.

override void SpriteBase.Clear ( )
virtual

Resets important sprite values to defaults for reuse.

Reimplemented from SpriteRoot.

Definition at line 1334 of file SpriteBase.cs.

override void SpriteBase.Copy ( SpriteRoot  s)
virtual

Copies all the vital attributes of another sprite.

Parameters
sSource sprite to be copied.

Reimplemented from SpriteRoot.

Definition at line 1390 of file SpriteBase.cs.

override void SpriteBase.Delete ( )
virtual

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.

Definition at line 1342 of file SpriteBase.cs.

Vector3 SpriteRoot.GetCenterPoint ( )
inherited

Gets the center point of the sprite, taking into account the actual positions of vertices.

Returns
The center point of the sprite.

Definition at line 2207 of file SpriteRoot.cs.

abstract int SpriteRoot.GetStateIndex ( string  stateName)
pure virtualinherited

Returns the index of the state with the specified name. -1 if no state matching the specified name is found.

Parameters
stateNameThe name of the state sought.
Returns
The zero-based index of the state, or -1 if no state is found by that name.

Implemented in AutoSpriteBase, and ManualSprite.

Rect SpriteRoot.GetUVs ( )
inherited

Returns the current UV coordinates of the sprite (before bleed compensation).

Returns
Rect containing the sprite's UV coordinates.

Definition at line 2183 of file SpriteRoot.cs.

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.

Returns
A reference to the sprite's vertices.

Definition at line 2194 of file SpriteRoot.cs.

override void SpriteBase.Hide ( bool  tf)
virtual

Hides or displays the sprite by disabling/enabling the sprite's mesh renderer component, or if managed, sets the mesh size to 0.

Parameters
tfWhen true, the sprite is hideAtStart, when false, the sprite will be displayed.

Reimplemented from SpriteRoot.

Definition at line 1403 of file SpriteBase.cs.

bool SpriteBase.IsAnimating ( )

Returns whether the sprite is currently animating.

Returns
True if the sprite is currently animating, false otherwise.

Definition at line 1566 of file SpriteBase.cs.

bool SpriteRoot.IsHidden ( )
inherited

Returns whether the sprite is currently set to be hideAtStart (whether its mesh renderer component is enabled).

Returns
True when hideAtStart, false when set to be displayed.

Definition at line 1942 of file SpriteRoot.cs.

void SpriteBase.PauseAnim ( )

Pauses the currently-playing animation.

Definition at line 1515 of file SpriteBase.cs.

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

Parameters
xyThe coordinates to convert.
Returns
The coordinates converted to UV coordinates.

Definition at line 2457 of file SpriteRoot.cs.

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

Parameters
xThe x-coordinate to convert.
yThe y-coordinate to convert.
Returns
The coordinates converted to UV coordinates.

Definition at line 2475 of file SpriteRoot.cs.

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

Parameters
xyThe values to convert.
Returns
The values converted to UV space.

Definition at line 2425 of file SpriteRoot.cs.

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

Parameters
xThe X-value to convert.
yThe Y-value to convert.
Returns
The values converted to UV space.

Definition at line 2443 of file SpriteRoot.cs.

void SpriteBase.RemoveSpriteresizedDelegate ( SpriteResizedDelegate  del)

Removes the specified delegate from the list of those to be called when the sprite is resized.

Parameters
delThe delegate to be removed.

Definition at line 1484 of file SpriteBase.cs.

void SpriteBase.RevertToStatic ( )

Reverts the sprite to its static (non-animating) default appearance.

Definition at line 1538 of file SpriteBase.cs.

void SpriteRoot.SetAnchor ( ANCHOR_METHOD  a)
inherited

Sets the anchor method to use. See ANCHOR_METHOD

Parameters
aThe anchor method to use.

Definition at line 2287 of file SpriteRoot.cs.

void SpriteBase.SetAnimCompleteDelegate ( AnimCompleteDelegate  del)

Sets the delegate to be called upon animation completion.

Parameters
delThe delegate to be called when an animation finishes playing.

Definition at line 1448 of file SpriteBase.cs.

void SpriteBase.SetAnimFrameDelegate ( AnimFrameDelegate  del)

Sets the delegate to be called each frame of animation.

Parameters
delThe delegate to be called each frame of animation.

Definition at line 1457 of file SpriteBase.cs.

void SpriteRoot.SetBleedCompensation ( float  x,
float  y 
)
inherited

Sets the bleed compensation to use (see bleedCompensation).

Definition at line 2059 of file SpriteRoot.cs.

void SpriteRoot.SetBleedCompensation ( Vector2  xy)
inherited

Sets the bleed compensation to use (see bleedCompensation).

Definition at line 2064 of file SpriteRoot.cs.

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.

Definition at line 1857 of file SpriteRoot.cs.

virtual void SpriteRoot.SetCamera ( Camera  c)
virtualinherited

Sets the camera to use when calculating a pixel-perfect sprite size.

Parameters
c

Definition at line 1869 of file SpriteRoot.cs.

virtual void SpriteRoot.SetColor ( Color  c)
virtualinherited

Sets the sprite's color to the specified color.

Parameters
cColor to shade the sprite.

Definition at line 1723 of file SpriteRoot.cs.

void SpriteRoot.SetDrawLayer ( int  layer)
inherited

Sets the draw layer of the sprite (only applies to managed sprites).

Parameters
layerThe draw layer of the sprite. Lower values cause an earlier draw order, higher values, a later draw order.

Definition at line 2105 of file SpriteRoot.cs.

void SpriteRoot.SetFrameInfo ( SPRITE_FRAME  fInfo)
inherited

Sets the sprite's frame info, which includes UVs, offsets, etc.

Parameters
fInfoA SPRITE_FRAME structure containing the frame info.

Definition at line 2121 of file SpriteRoot.cs.

void SpriteBase.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.

Parameters
fpsThe new framerate, in frames per second.

Definition at line 1506 of file SpriteBase.cs.

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.

Parameters
matThe new material.

Definition at line 1813 of file SpriteRoot.cs.

void SpriteRoot.SetOffset ( Vector3  o)
inherited

Sets the offset of the sprite from its GameObject. See offset

Parameters
oThe offset to use.

Definition at line 2309 of file SpriteRoot.cs.

void SpriteRoot.SetPlane ( SPRITE_PLANE  p)
inherited

Sets the plane in which the sprite is to be drawn. See: SPRITE_PLANE

Parameters
pThe plane in which the sprite should be drawn.

Definition at line 2082 of file SpriteRoot.cs.

virtual void SpriteRoot.SetSize ( float  w,
float  h 
)
virtualinherited

Sets the physical dimensions of the sprite in the plane selected

Parameters
widthWidth of the sprite in world space.
heightHeight of the sprite in world space.

Definition at line 1384 of file SpriteRoot.cs.

void SpriteBase.SetSpriteResizedDelegate ( SpriteResizedDelegate  del)

Sets the delegate to be called when the sprite is resized.

Parameters
delThe delegate to be called when the sprite is resized.

Definition at line 1466 of file SpriteBase.cs.

abstract void SpriteRoot.SetState ( int  index)
pure virtualinherited

Sets the sprite to the specified state/animation.

Parameters
indexThe zero-based index of the desired state/animation.

Implemented in AutoSpriteBase, and ManualSprite.

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.

Parameters
texThe new texture.

Definition at line 1795 of file SpriteRoot.cs.

void SpriteRoot.SetUVs ( Rect  uv)
inherited

Sets the sprite's UVs to the specified values.

Parameters
nextFrameA Rect containing the new UV coordinates.

Definition at line 2136 of file SpriteRoot.cs.

void SpriteRoot.SetUVsFromPixelCoords ( Rect  pxCoords)
inherited

Sets the sprite's UVs from pixel coordinates.

Parameters
pxCoordsA 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.

Definition at line 2161 of file SpriteRoot.cs.

void SpriteRoot.SetWindingOrder ( WINDING_ORDER  order)
inherited

Sets the winding order to use. See WINDING_ORDER.

Parameters
orderThe winding order to use.

Definition at line 2092 of file SpriteRoot.cs.

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.

virtual void SpriteBase.StopAnim ( )
virtual

Stops the current animation from playing and resets it to the beginning for playing again. The sprite then reverts to the static image.

Reimplemented in AutoSpriteBase, and ManualSprite.

Definition at line 1532 of file SpriteBase.cs.

virtual void SpriteRoot.TruncateBottom ( float  pct)
virtualinherited

Truncates the bottom edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation

Parameters
pctThe percentage of the sprite to truncate (0-1)

Definition at line 1599 of file SpriteRoot.cs.

virtual void SpriteRoot.TruncateLeft ( float  pct)
virtualinherited

Truncates the left edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation

Parameters
pctThe percentage of the sprite to truncate (0-1)

Definition at line 1555 of file SpriteRoot.cs.

virtual void SpriteRoot.TruncateRight ( float  pct)
virtualinherited

Truncates the right edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation

Parameters
pctThe percentage of the sprite to truncate (0-1)

Definition at line 1533 of file SpriteRoot.cs.

virtual void SpriteRoot.TruncateTop ( float  pct)
virtualinherited

Truncates the top edge of the sprite to the specified percentage. 1 == no truncation 0 == complete truncation

Parameters
pctThe percentage of the sprite to truncate (0-1)

Definition at line 1577 of file SpriteRoot.cs.

virtual void SpriteRoot.Unclip ( )
virtualinherited

Removes any clipping that is being applied to the sprite.

Definition at line 1636 of file SpriteRoot.cs.

virtual void SpriteRoot.Untruncate ( )
virtualinherited

Removes any truncation.

Definition at line 1618 of file SpriteRoot.cs.

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.

Definition at line 1847 of file SpriteRoot.cs.

virtual void SpriteRoot.UpdateUVs ( )
virtualinherited

Applies any changes to the UVs to the actual sprite mesh.

Definition at line 1654 of file SpriteRoot.cs.

Member Data Documentation

ANCHOR_METHOD SpriteRoot.anchor = ANCHOR_METHOD.TEXTURE_OFFSET
inherited

Anchor method to use.

See Also
ANCHOR_METHOD

Definition at line 749 of file SpriteRoot.cs.

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.

Definition at line 771 of file SpriteRoot.cs.

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.

Definition at line 744 of file SpriteRoot.cs.

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.

Definition at line 824 of file SpriteRoot.cs.

int SpriteBase.defaultAnim = 0

Index of the animation to play by default.

Definition at line 1297 of file SpriteBase.cs.

int SpriteRoot.drawLayer
inherited

The layer in which the sprite will be drawn if managed.

Definition at line 711 of file SpriteRoot.cs.

float SpriteRoot.height
inherited

Height of the sprite in world space.

Definition at line 737 of file SpriteRoot.cs.

bool SpriteRoot.hideAtStart = false
inherited

Whether the sprite will be hideAtStart when it starts.

Definition at line 856 of file SpriteRoot.cs.

bool SpriteRoot.ignoreClipping = false
inherited

When true, the sprite will not be clipped.

Definition at line 868 of file SpriteRoot.cs.

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

Definition at line 696 of file SpriteRoot.cs.

SpriteManager SpriteRoot.manager
inherited

Reference to the manager which will manage this sprite, provided managed is set to true.

Definition at line 702 of file SpriteRoot.cs.

Vector3 SpriteRoot.offset = new Vector3()
inherited

Offsets the sprite, in world space, from the center of its GameObject.

Definition at line 816 of file SpriteRoot.cs.

bool SpriteRoot.persistent = false
inherited

This must be set to true at design time for the sprite to survive loading a new level.

Definition at line 716 of file SpriteRoot.cs.

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.

Definition at line 762 of file SpriteRoot.cs.

SPRITE_PLANE SpriteRoot.plane = SPRITE_PLANE.XY
inherited

The plane in which the sprite will be drawn.

Definition at line 721 of file SpriteRoot.cs.

bool SpriteBase.playAnimOnStart = false

When set to true, the sprite will play the default animation (see defaultAnim) when the sprite is instantiated.

Definition at line 1284 of file SpriteBase.cs.

float SpriteRoot.width
inherited

Width of the sprite in world space.

Definition at line 732 of file SpriteRoot.cs.

WINDING_ORDER SpriteRoot.winding = WINDING_ORDER.CW
inherited

The winding order of the sprite's polygons - determines the direction the sprite will "face".

Definition at line 727 of file SpriteRoot.cs.

Property Documentation

ANCHOR_METHOD SpriteRoot.Anchor
getsetinherited

Accessor for the object's anchor method.

Definition at line 2298 of file SpriteRoot.cs.

bool SpriteBase.Animating
getset

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.

Definition at line 1575 of file SpriteBase.cs.

Vector3 SpriteRoot.BottomRight
getinherited

Returns the position of the bottom-right vertex of the sprite after any clipping or trimming.

Definition at line 2369 of file SpriteRoot.cs.

virtual bool SpriteRoot.Clipped
getsetinherited

Accessor for whether the sprite is to be clipped by any already-specified clipping rect.

Definition at line 2265 of file SpriteRoot.cs.

virtual Rect3D SpriteRoot.ClippingRect
getsetinherited

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.

Definition at line 2233 of file SpriteRoot.cs.

Color SpriteRoot.Color
getsetinherited

Accessor for the object's current overall color tint.

Definition at line 1736 of file SpriteRoot.cs.

int SpriteBase.CurAnimIndex
getset

Property useful for use with EZ Game Saver. Include this as a saved property, along with Animating, so that any playing animation is resumed.

Definition at line 1592 of file SpriteBase.cs.

Vector2 SpriteRoot.ImageSize
getinherited

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.

Definition at line 1970 of file SpriteRoot.cs.

bool SpriteRoot.Managed
getsetinherited

Sets the sprite to a managed or batched state.

Definition at line 1979 of file SpriteRoot.cs.

Vector2 SpriteRoot.PixelSize
getsetinherited

Gets/Sets the width and height of the sprite in pixels as it appears on-screen.

Definition at line 1956 of file SpriteRoot.cs.

virtual Camera SpriteRoot.RenderCamera
getsetinherited

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.

Definition at line 1831 of file SpriteRoot.cs.

Vector3 SpriteRoot.TopLeft
getinherited

Returns the position of the top-left vertex of the sprite after any clipping or trimming.

Definition at line 2354 of file SpriteRoot.cs.

Vector3 SpriteRoot.UnclippedBottomRight
getinherited

The bottom-right corner of the sprite when no clipping or trimming is applied.

Definition at line 2337 of file SpriteRoot.cs.

Vector3 SpriteRoot.UnclippedTopLeft
getinherited

The top-left corner of the sprite when no clipping or trimming is applied.

Definition at line 2320 of file SpriteRoot.cs.


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