Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.CursorIconBase Class Reference
Inheritance diagram for AC.CursorIconBase:
AC.CursorIcon

Public Member Functions

 CursorIconBase ()
 
void Copy (CursorIconBase _icon)
 Copies the values from another CursorIconBase. More...
 
void DrawAsInteraction (Rect _rect, bool isActive)
 Draws the graphic as part of a Menu, for when it's displayed within a MenuGraphic or MenuInteraction. More...
 
UnityEngine.Sprite GetSprite ()
 Gets a Sprite based on the texture supplied. The Sprite will be generated on the fly if it does not already exist. More...
 
UnityEngine.Sprite GetAnimatedSprite (int _frameIndex)
 Gets a Sprite based on the animated texture supplied. The Sprite will be generated on the fly if it does not already exist. More...
 
UnityEngine.Sprite GetAnimatedSprite (bool isActive)
 Gets a Sprite based on the animated texture supplied, when the texture is used within a MenuElement (MenuGraphic or MenuInteraction). The Sprite will be generated on the fly if it does not already exist. More...
 
void ReplaceTexture (Texture newTexture)
 Replaces the icon's texture, and also clears internal caches. More...
 
void ClearSprites ()
 
Texture2D GetAnimatedTexture (bool canAnimate=true)
 Gets a slice of the texture that represents the current frame, if the texture consists of animated frames. More...
 
string GetName ()
 Gets a unique identifier, based on the texture and current animation frame. More...
 
virtual void ClearCache ()
 
Texture Draw (Vector2 centre, bool canAnimate=true)
 Draws the texture as a cursor icon More...
 
Rect GetAnimatedRect ()
 Gets a Rect that describes a slice of the animated texture that represents the current frame. More...
 
Rect GetAnimatedRect (int _frameIndex)
 Gets a Rect that describes a slice of the animated texture that represents a specific frame. More...
 
void Reset ()
 
void ShowGUI (bool includeSize, bool includeAlwaysAnimate=true, string _label="Texture:", CursorRendering cursorRendering=CursorRendering.Software, string apiPrefix="", string tooltip="")
 

Public Attributes

Texture texture
 
bool isAnimated = false
 
int numFrames = 1
 
int numRows = 1
 
int numCols = 1
 
float size = 0.015f
 
float animSpeed = 4f
 
bool endAnimOnLastFrame = false
 
bool skipFirstFrameWhenLooping = false
 
Vector2 clickOffset
 
float[] frameSpeeds
 
bool alwaysAnimate = false
 

Detailed Description

A data container for all cursor icons, as well as animated textures used by MenuGraphic.

Constructor & Destructor Documentation

◆ CursorIconBase()

AC.CursorIconBase.CursorIconBase ( )

The default Constructor.

Member Function Documentation

◆ ClearCache()

virtual void AC.CursorIconBase.ClearCache ( )
virtual

Clears the animated Texture2D and Sprite caches.

Reimplemented in AC.CursorIcon.

◆ ClearSprites()

void AC.CursorIconBase.ClearSprites ( )

Clears the generated sprite.

◆ Copy()

void AC.CursorIconBase.Copy ( CursorIconBase  _icon)

Copies the values from another CursorIconBase.

Parameters
_iconThe CursorIconBase to copy from

◆ Draw()

Texture AC.CursorIconBase.Draw ( Vector2  centre,
bool  canAnimate = true 
)

Draws the texture as a cursor icon

Parameters
centreThe cursor's centre position on-screen
canAnimateIf True, and isAnimated = True, the texture can be animated. If False, the texture will never animate
Returns
The texture displayed, which may be only a portion of the whole texture if animated

◆ DrawAsInteraction()

void AC.CursorIconBase.DrawAsInteraction ( Rect  _rect,
bool  isActive 
)

Draws the graphic as part of a Menu, for when it's displayed within a MenuGraphic or MenuInteraction.

Parameters
_rectThe dimensions to draw the graphic
isActiveIf True, then the associated MenuElement is active (e.g. the mouse is hovering over it)

◆ GetAnimatedRect() [1/2]

Rect AC.CursorIconBase.GetAnimatedRect ( )

Gets a Rect that describes a slice of the animated texture that represents the current frame.

Returns
A Rect that describes a slice of the animated texture that represents the current frame

◆ GetAnimatedRect() [2/2]

Rect AC.CursorIconBase.GetAnimatedRect ( int  _frameIndex)

Gets a Rect that describes a slice of the animated texture that represents a specific frame.

Parameters
_frameIndexThe frame in question
Returns
A Rect that describes a slice of the animated texture that represents a specific frame

◆ GetAnimatedSprite() [1/2]

UnityEngine.Sprite AC.CursorIconBase.GetAnimatedSprite ( bool  isActive)

Gets a Sprite based on the animated texture supplied, when the texture is used within a MenuElement (MenuGraphic or MenuInteraction). The Sprite will be generated on the fly if it does not already exist.

Parameters
isActiveIf True, then the associated MenuElement is active (e.g. the mouse is hovering over it)
Returns
The generated Sprite

◆ GetAnimatedSprite() [2/2]

UnityEngine.Sprite AC.CursorIconBase.GetAnimatedSprite ( int  _frameIndex)

Gets a Sprite based on the animated texture supplied. The Sprite will be generated on the fly if it does not already exist.

Parameters
_frameIndexThe texture frame to convert
Returns
The generated Sprite

◆ GetAnimatedTexture()

Texture2D AC.CursorIconBase.GetAnimatedTexture ( bool  canAnimate = true)

Gets a slice of the texture that represents the current frame, if the texture consists of animated frames.

Returns
A frame of animation

◆ GetName()

string AC.CursorIconBase.GetName ( )

Gets a unique identifier, based on the texture and current animation frame.

Returns
A unique identifier for the instance

◆ GetSprite()

UnityEngine.Sprite AC.CursorIconBase.GetSprite ( )

Gets a Sprite based on the texture supplied. The Sprite will be generated on the fly if it does not already exist.

Returns
The generated Sprite

◆ ReplaceTexture()

void AC.CursorIconBase.ReplaceTexture ( Texture  newTexture)

Replaces the icon's texture, and also clears internal caches.

Parameters
newTextureThe icon's new texture

◆ Reset()

void AC.CursorIconBase.Reset ( )

Resets the animation, if the texture is animated.

Member Data Documentation

◆ alwaysAnimate

bool AC.CursorIconBase.alwaysAnimate = false

If True, and isAnimated = True, then the animation will occur always and not just when made active

◆ animSpeed

float AC.CursorIconBase.animSpeed = 4f

The animation playback speed, if animated

◆ clickOffset

Vector2 AC.CursorIconBase.clickOffset

The offset of the "click point", when used as a cursor

◆ endAnimOnLastFrame

bool AC.CursorIconBase.endAnimOnLastFrame = false

If True, then animations will end on the final frame, rather than looping

◆ frameSpeeds

float [] AC.CursorIconBase.frameSpeeds

An array of the speeds for each frame when animating, where the index of the array corresponds to the frame of the animation

◆ isAnimated

bool AC.CursorIconBase.isAnimated = false

If True, then the texture will be considered to consist of multiple animation frames, and they will be displayed sequentially

◆ numCols

int AC.CursorIconBase.numCols = 1

The number of columns in the texture, if animated

◆ numFrames

int AC.CursorIconBase.numFrames = 1

The number of frames in the texture, if animated

◆ numRows

int AC.CursorIconBase.numRows = 1

The number of rows in the texture, if animated

◆ size

float AC.CursorIconBase.size = 0.015f

The size of the icon

◆ skipFirstFrameWhenLooping

bool AC.CursorIconBase.skipFirstFrameWhenLooping = false

If True, and isAnimated = True, then the first frame will be skipped when in a looping animation

◆ texture

Texture AC.CursorIconBase.texture

The texture to use