SpriteManager Class Reference

Allows multiple sprites to be combined into a single mesh. Sprites are transformed using bones which are linked to GameObjects. More...

List of all members.

Public Member Functions

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()!
bool AlreadyAdded (SpriteRoot sprite)
 Returns whether the sprite is already managed by this manager.
SpriteMesh_Managed AddSprite (GameObject go)
 Adds the sprite attached to the specified GameObject to the SpriteManager.
SpriteMesh_Managed AddSprite (SpriteRoot sprite)
 Adds the specified sprite to the SpriteManager.
SpriteRoot CreateSprite (GameObject prefab)
 Instantiates the specified prefab, which should contain a sprite, and immediately adds it to the manager.
SpriteRoot CreateSprite (GameObject prefab, Vector3 position, Quaternion rotation)
 Instantiates the specified prefab, which should contain a sprite, and immediately adds it to the manager.
void RemoveSprite (SpriteRoot sprite)
 Removes the specified sprite from the manager.
void MoveToFront (SpriteMesh_Managed s)
 Moves the specified sprite to the end of the drawing order. (Causes it to appear in front of other sprites.).
void MoveToBack (SpriteMesh_Managed s)
 Moves the specified sprite to the start of the drawing order. (Causes it to appear behind other sprites.).
void MoveInfrontOf (SpriteMesh_Managed toMove, SpriteMesh_Managed reference)
 Moves the first sprite in front of the second sprite by placing it later in the draw order. If the sprite is already in front of the reference sprite, nothing is changed.
void MoveBehind (SpriteMesh_Managed toMove, SpriteMesh_Managed reference)
 Moves the first sprite behind the second sprite by placing it earlier in the draw order. If the sprite is already behind, nothing is done.
void UpdateBounds ()
 Instructs the manager to recalculate the bounds of the mesh.
void ScheduleBoundsUpdate (float seconds)
 Schedules a recalculation of the mesh bounds to occur at a regular interval (given in seconds).
void CancelBoundsUpdate ()
 Cancels any previously scheduled bounds recalculations.

Public Attributes

SpriteRoot.WINDING_ORDER winding = SpriteRoot.WINDING_ORDER.CW
 Whether sprite polygons should be wound clock-wise or counter clock-wise. Determines which side of the sprite is considered by the renderer to be the "front".
int allocBlockSize = 10
 How many sprites to allocate at a time if the sprite pool is used up. This is also the starting pool size.
bool autoUpdateBounds = true
 When true, will automatically recalculate the bounding box for the mesh whenever sprite vertices change. If the bounding box is never recalculated, when the camera moves, Unity may think the mesh is out of sight and cull it, even though it is not.
bool persistent = false
 If true, the SpriteManager object and associated mesh will survive a level load.

Detailed Description

Allows multiple sprites to be combined into a single mesh. Sprites are transformed using bones which are linked to GameObjects.


Member Function Documentation

SpriteMesh_Managed SpriteManager.AddSprite ( SpriteRoot  sprite  ) 

Adds the specified sprite to the SpriteManager.

Parameters:
go Reference to the desired sprite.
Returns:
A reference to the sprite's managed mesh.
SpriteMesh_Managed SpriteManager.AddSprite ( GameObject  go  ) 

Adds the sprite attached to the specified GameObject to the SpriteManager.

Parameters:
go GameObject containing a sprite.
Returns:
A reference to the sprite's managed mesh.
bool SpriteManager.AlreadyAdded ( SpriteRoot  sprite  ) 

Returns whether the sprite is already managed by this manager.

Parameters:
sprite Sprite for which to look.
Returns:
True when the sprite is already being managed by this manager.
void SpriteManager.CancelBoundsUpdate (  ) 

Cancels any previously scheduled bounds recalculations.

SpriteRoot SpriteManager.CreateSprite ( GameObject  prefab,
Vector3  position,
Quaternion  rotation 
)

Instantiates the specified prefab, which should contain a sprite, and immediately adds it to the manager.

Parameters:
prefab Prefab to be instantiated.
position Where to place the new sprite.
rotation Rotation of the new sprite.
Returns:
Reference to the sprite contained in the prafab.
SpriteRoot SpriteManager.CreateSprite ( GameObject  prefab  ) 

Instantiates the specified prefab, which should contain a sprite, and immediately adds it to the manager.

Parameters:
prefab Prefab to be instantiated.
Returns:
Reference to the sprite contained in the prafab.
void SpriteManager.MoveBehind ( SpriteMesh_Managed  toMove,
SpriteMesh_Managed  reference 
)

Moves the first sprite behind the second sprite by placing it earlier in the draw order. If the sprite is already behind, nothing is done.

Parameters:
toMove Sprite to move behind the reference sprite.
reference Sprite behind which "toMove" will be drawn.
void SpriteManager.MoveInfrontOf ( SpriteMesh_Managed  toMove,
SpriteMesh_Managed  reference 
)

Moves the first sprite in front of the second sprite by placing it later in the draw order. If the sprite is already in front of the reference sprite, nothing is changed.

Parameters:
toMove Sprite to move in front of the reference sprite.
reference Sprite in front of which "toMove" will be drawn.
void SpriteManager.MoveToBack ( SpriteMesh_Managed  s  ) 

Moves the specified sprite to the start of the drawing order. (Causes it to appear behind other sprites.).

Parameters:
s Sprite to move to the start of the drawing order.
void SpriteManager.MoveToFront ( SpriteMesh_Managed  s  ) 

Moves the specified sprite to the end of the drawing order. (Causes it to appear in front of other sprites.).

Parameters:
s Sprite to move to the end of the drawing order.
Vector2 SpriteManager.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()!

Parameters:
x The x-coordinate to convert.
y The y-coordinate to convert.
Returns:
The coordinates converted to UV coordinates.
Vector2 SpriteManager.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()!

Parameters:
xy The coordinates to convert.
Returns:
The coordinates converted to UV coordinates.
Vector2 SpriteManager.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()!

Parameters:
x The X-value to convert.
y The Y-value to convert.
Returns:
The values converted to UV space.
Vector2 SpriteManager.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()!

Parameters:
xy The values to convert.
Returns:
The values converted to UV space.
void SpriteManager.RemoveSprite ( SpriteRoot  sprite  ) 

Removes the specified sprite from the manager.

Parameters:
sprite Sprite to remove from the manager.
void SpriteManager.ScheduleBoundsUpdate ( float  seconds  ) 

Schedules a recalculation of the mesh bounds to occur at a regular interval (given in seconds).

Parameters:
seconds Time, in seconds, between bounds updates.
void SpriteManager.UpdateBounds (  ) 

Instructs the manager to recalculate the bounds of the mesh.


Member Data Documentation

How many sprites to allocate at a time if the sprite pool is used up. This is also the starting pool size.

When true, will automatically recalculate the bounding box for the mesh whenever sprite vertices change. If the bounding box is never recalculated, when the camera moves, Unity may think the mesh is out of sight and cull it, even though it is not.

If true, the SpriteManager object and associated mesh will survive a level load.

SpriteRoot.WINDING_ORDER SpriteManager.winding = SpriteRoot.WINDING_ORDER.CW

Whether sprite polygons should be wound clock-wise or counter clock-wise. Determines which side of the sprite is considered by the renderer to be the "front".


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

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