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

Public Member Functions

void SetAlpha (float _alpha)
 Forces the alpha value of a sprite to a specific value. More...
 
float GetAlpha ()
 Gets the alpha value of the SpriteRenderer, which in turn is determind by its color More...
 
void Fade (FadeType _fadeType, float _fadeTime, float startAlpha=-1)
 Fades the Sprite attached to this GameObject in or out. More...
 
void EndFade ()
 

Public Attributes

bool affectChildren = false
 
float minAlpha = 0f
 
float maxAlpha = 1f
 

Protected Member Functions

void Awake ()
 
float Remap (float value, float from1, float to1, float from2, float to2)
 
void SetSpriteAlpha (SpriteRenderer _spriteRenderer, float alpha)
 
void SetEnabledState (bool value)
 
IEnumerator DoFade ()
 

Protected Attributes

SpriteRenderer spriteRenderer
 
SpriteRenderer[] childSprites
 

Properties

bool IsFading [get]
 
float FadeStartTime [get]
 
float FadeTime [get]
 
FadeType FadeType [get]
 

Detailed Description

Provides functions that can fade a sprite in and out.

Member Function Documentation

◆ EndFade()

void AC.SpriteFader.EndFade ( )

Ends the sprite-fading effect, and sets the Sprite's alpha to its target value.

◆ Fade()

void AC.SpriteFader.Fade ( FadeType  _fadeType,
float  _fadeTime,
float  startAlpha = -1 
)

Fades the Sprite attached to this GameObject in or out.

Parameters
_fadeTypeThe direction of the fade effect (fadeIn, fadeOut)
_fadeTimeThe duration, in seconds, of the fade effect
startAlphaThe alpha value that the Sprite should have when the effect begins. If <0, the Sprite's original alpha will be used.

◆ GetAlpha()

float AC.SpriteFader.GetAlpha ( )

Gets the alpha value of the SpriteRenderer, which in turn is determind by its color

Returns
Gets the alpha value of the SpriteRenderer, where 0 = fully transparent, and 1 = fully opaque

◆ SetAlpha()

void AC.SpriteFader.SetAlpha ( float  _alpha)

Forces the alpha value of a sprite to a specific value.

Parameters
_alphaThe alpha value to assign the sprite attached to this GameObject

Member Data Documentation

◆ affectChildren

bool AC.SpriteFader.affectChildren = false

If True, then child Sprite will also be affected

Property Documentation

◆ FadeStartTime

float AC.SpriteFader.FadeStartTime
get

The time at which the sprite began fading

◆ FadeTime

float AC.SpriteFader.FadeTime
get

The duration of the sprite-fading effect

◆ FadeType

FadeType AC.SpriteFader.FadeType
get

The direction of the sprite-fading effect (fadeIn, fadeOut)

◆ IsFading

bool AC.SpriteFader.IsFading
get

True if the Sprite attached to the GameObject this script is attached to is currently fading