Allows multiple sprites to be combined into a single mesh. Sprites are transformed using bones which are linked to GameObjects. More...
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. |
Allows multiple sprites to be combined into a single mesh. Sprites are transformed using bones which are linked to GameObjects.
SpriteMesh_Managed SpriteManager.AddSprite | ( | SpriteRoot | sprite | ) |
Adds the specified sprite to the SpriteManager.
go | Reference to the desired sprite. |
SpriteMesh_Managed SpriteManager.AddSprite | ( | GameObject | go | ) |
Adds the sprite attached to the specified GameObject to the SpriteManager.
go | GameObject containing a sprite. |
bool SpriteManager.AlreadyAdded | ( | SpriteRoot | sprite | ) |
Returns whether the sprite is already managed by this manager.
sprite | Sprite for which to look. |
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.
prefab | Prefab to be instantiated. | |
position | Where to place the new sprite. | |
rotation | Rotation of the new sprite. |
SpriteRoot SpriteManager.CreateSprite | ( | GameObject | prefab | ) |
Instantiates the specified prefab, which should contain a sprite, and immediately adds it to the manager.
prefab | Prefab to be instantiated. |
void SpriteManager.MoveBehind | ( | SpriteMesh_Managed | toMove, | |
SpriteMesh_Managed | reference | |||
) |
void SpriteManager.MoveInfrontOf | ( | SpriteMesh_Managed | toMove, | |
SpriteMesh_Managed | reference | |||
) |
void SpriteManager.MoveToBack | ( | SpriteMesh_Managed | s | ) |
Moves the specified sprite to the start of the drawing order. (Causes it to appear behind other sprites.).
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.).
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()!
x | The x-coordinate to convert. | |
y | The y-coordinate to convert. |
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()!
xy | The coordinates to convert. |
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()!
x | The X-value to convert. | |
y | The Y-value to convert. |
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()!
xy | The values to convert. |
void SpriteManager.RemoveSprite | ( | SpriteRoot | sprite | ) |
Removes the specified sprite from the manager.
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).
seconds | Time, in seconds, between bounds updates. |
void SpriteManager.UpdateBounds | ( | ) |
Instructs the manager to recalculate the bounds of the mesh.
int SpriteManager.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 SpriteManager.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 SpriteManager.persistent = false |
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".