SpriteRendererToGraphicsInterfaceAdapter Class Reference

This class provides a way to access a SpriteRenderer component, on the same GameObject, through all the various IGraphics interfaces.

Public Member Functions

override void SetPropertyBlock (MaterialPropertyBlock dest, int matIndex)
 SpriteRenderers do not use material property blocks, even though they use materials, it just messes them up.
So we disable the function by overriding it to do nothing. Instead, we override the functionality of the color and mainTexture accessors.
 
- Public Member Functions inherited from BaseRendererToGraphicsInterfaceAdapter< SpriteRenderer >
void GetPropertyBlock (out MaterialPropertyBlock dest)
 Matches the form of the unity Renderer function of the same name.
 
virtual void GetPropertyBlock (out MaterialPropertyBlock dest, int matIndex)
 Finds and sets the reference of parameter dest, to the Property block found in the renderer's material (at the provided index).
 
virtual bool HasColor ()
 Returns weather or not the material(first material on renderer) actually has a color value that can be used.
 
virtual bool HasColor (int matIndex)
 Specifies if the material the renderer uses (at the provided index), has a _Color
 
virtual bool HasTexture ()
 Returns weather or not the material(first material on renderer) actually has a texture variable that can be used.
 
virtual bool HasTexture (int matIndex)
 Specifies if the material the renderer uses (at the provided index), has a _MainTexture
 
virtual void RebuildPropertyBlock ()
 This function is called when an enabled state is changed. It clears the current property block, and re-adds the assigned color and, if not null, the assigned texture.
 
void RebuildPropertyBlock (int matIndex)
 This function will be invoked wen the property block needs to be rebuilt. For example, if it contains a texture, and a texture is added
 
void SetPropertyBlock (MaterialPropertyBlock dest)
 Matches the form of the unity Renderer function of the same name. Caches and assigns the provided MaterialPropertyBlock to the rendererRef.
 
virtual void ValidateViewableState ()
 Invoked OnEnable to ensure that all descendants of this object in the hierarchy (that implement IGraphicsViewable), are set the same "viewable" state as this object.
 

Protected Member Functions

override Bounds GetLocalBounds ()
 Checks the sprite renderer on this object for a valid sprite, and if one is found, returns it's bounds.
 

Properties

override Color color [get, set]
 returns the currentColor that is assigned to the material property block. when set, checks enabled status, and caches then assigns the color to the material property block.
 
override Texture mainTexture [get, set]
 Since sprite textures are not changeable, assigning a new/different texture to this accessor will create a new runtime-only Sprite, that will then be assigned to the sprite renderer.
 
- Properties inherited from BaseRendererToGraphicsInterfaceAdapter< SpriteRenderer >
virtual Bounds bounds [get]
 Returns the local bounds of this object as defined by the virtual GetLocalBounds function. If the boundsIncludesDecendants member is true, the returned bounds will encapsulate all IGraphicsBounds scene descendants of this object.
 
virtual Color color [get, set]
 returns the currentColor that is assigned to the material property block. when set, checks enabled status, and caches then assigns the color to the material property block.
 
virtual bool colorInterfaceEnabled [get, set]
 This overridable accessor simply get/sets the stored enabled/disabled state of the color adapter. If false, changes to this components color, will NOT affect the renderer.
 
virtual bool isViewable [get, set]
 Return true if the rendererRef is enabled. Not affected by weather or not the object is actually visible by any camera. Setting this value will set the state of the refererRef. When isViewableIncludesDecendants is true; the getter will return true if ANY descendant IGraphicsViewable, or this object isViewable. And the setter will set the rendererRef enabled state for ALL descendant IGraphicsViewable components.
 
virtual Texture mainTexture [get, set]
 Get accessor returns the cashed currentMainTexture reference, assigned by the user to this IGraphicsTexureInterface. Assignment of a different texture will also set the texture used by the material in the rendererRef.
 
TRendererType rendererRef [get, set]
 Accessor to the Renderer being adapted. If no renderer has been specified, it will attempt to find a renderer of type TRendererType, attached to this GameObject.
 
virtual bool textureInterfaceEnabled [get, set]
 Used to enable/disable use of the texture provided. Changing this value will force a rebuild of the property block used to display the texture.
 

Additional Inherited Members

- Public Attributes inherited from BaseRendererToGraphicsInterfaceAdapter< SpriteRenderer >
bool boundsIncludesDecendants
 Specified weather the bounds accessor should encapsulate the bounds of IGraphicsBounds of this GameObject's scene hierarchy descendants.
 
Texture currentMainTexture
 Cashed reference to the texture used.
 
bool isViewableIncludesDecendants
 When true, isViewable will return true if this object or ANY descendant IGraphicsViewable has isViewable return true.
 
- Protected Attributes inherited from BaseRendererToGraphicsInterfaceAdapter< SpriteRenderer >
Color currentColor
 Stores the current color that is assigned to the material property block.
 
+ Inheritance diagram for SpriteRendererToGraphicsInterfaceAdapter:
+ Collaboration diagram for SpriteRendererToGraphicsInterfaceAdapter: