TopDown Engine  v4.2
MoreMountains.Tools.MMFader Class Reference

The Fader class can be put on an Image, and it'll intercept MMFadeEvents and turn itself on or off accordingly. More...

Inheritance diagram for MoreMountains.Tools.MMFader:
MoreMountains.Tools.MMMonoBehaviour MoreMountains.Tools.MMEventListener< MMFadeEvent > MoreMountains.Tools.MMEventListener< MMFadeInEvent > MoreMountains.Tools.MMEventListener< MMFadeOutEvent > MoreMountains.Tools.MMEventListener< MMFadeStopEvent >

Public Types

enum  ForcedInitStates { ForcedInitStates.None, ForcedInitStates.Active, ForcedInitStates.Inactive }
 

Public Member Functions

virtual void OnMMEvent (MMFadeEvent fadeEvent)
 When catching a fade event, we fade our image in or out More...
 
virtual void OnMMEvent (MMFadeInEvent fadeEvent)
 When catching an MMFadeInEvent, we fade our image in More...
 
virtual void OnMMEvent (MMFadeOutEvent fadeEvent)
 When catching an MMFadeOutEvent, we fade our image out More...
 
virtual void Fade (float targetAlpha, float duration, MMTweenType curve, bool ignoreTimeScale)
 Use this method to fade towards the specified target alpha More...
 
virtual void FadeIn (float duration, MMTweenType curve, bool ignoreTimeScale=true)
 Use this method to cause a fade in over the specified duration and curve More...
 
virtual void FadeOut (float duration, MMTweenType curve, bool ignoreTimeScale=true)
 Use this method to cause a fade out over the specified duration and curve More...
 
virtual void OnMMEvent (MMFadeStopEvent fadeStopEvent)
 When catching an MMFadeStopEvent, we stop our fade More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMFadeEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMFadeInEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMFadeOutEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMFadeStopEvent >
void OnMMEvent (T eventType)
 

Public Attributes

int ID
 the ID for this fader (0 is default), set more IDs if you need more than one fader More...
 
float InactiveAlpha = 0f
 the opacity the fader should be at when inactive More...
 
float ActiveAlpha = 1f
 the opacity the fader should be at when active More...
 
ForcedInitStates ForcedInitState = ForcedInitStates.Inactive
 determines whether a state should be forced on init More...
 
float DefaultDuration = 0.2f
 the default duration of the fade in/out More...
 
MMTweenType DefaultTween = new MMTweenType(MMTween.MMTweenCurve.LinearTween)
 the default curve to use for this fader More...
 
bool IgnoreTimescale = true
 whether or not the fade should happen in unscaled time More...
 
bool CanFadeToCurrentAlpha = true
 whether or not this fader can cause a fade if the requested final alpha is the same as the current one More...
 
bool ShouldBlockRaycasts = false
 whether or not the fader should block raycasts when visible More...
 
bool DebugToolbar
 

Protected Member Functions

virtual void ResetFader ()
 Test method triggered by an inspector button More...
 
virtual void DefaultFade ()
 Test method triggered by an inspector button More...
 
virtual void FadeIn1Second ()
 Test method triggered by an inspector button More...
 
virtual void FadeOut1Second ()
 Test method triggered by an inspector button More...
 
virtual void Awake ()
 On Start, we initialize our fader More...
 
virtual void Initialization ()
 On init, we grab our components, and disable/hide everything More...
 
virtual void Update ()
 On Update, we update our alpha More...
 
virtual void Fade ()
 Fades the canvasgroup towards its target alpha More...
 
virtual void StopFading ()
 Stops the fading. More...
 
virtual void DisableFader ()
 Disables the fader. More...
 
virtual void EnableFader ()
 Enables the fader. More...
 
virtual void StartFading (float initialAlpha, float endAlpha, float duration, MMTweenType curve, bool ignoreTimeScale)
 Starts fading this fader from the specified initial alpha to the target More...
 
virtual void OnEnable ()
 On enable, we start listening to events More...
 
virtual void OnDisable ()
 On disable, we stop listening to events More...
 

Protected Attributes

CanvasGroup _canvasGroup
 
float _initialAlpha
 
float _currentTargetAlpha
 
float _currentDuration
 
MMTweenType _currentCurve
 
bool _fading = false
 
float _fadeStartedAt
 
bool _frameCountOne
 

Detailed Description

The Fader class can be put on an Image, and it'll intercept MMFadeEvents and turn itself on or off accordingly.

Member Enumeration Documentation

◆ ForcedInitStates

Enumerator
None 
Active 
Inactive 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMFader.Awake ( )
protectedvirtual

On Start, we initialize our fader

◆ DefaultFade()

virtual void MoreMountains.Tools.MMFader.DefaultFade ( )
protectedvirtual

Test method triggered by an inspector button

◆ DisableFader()

virtual void MoreMountains.Tools.MMFader.DisableFader ( )
protectedvirtual

Disables the fader.

◆ EnableFader()

virtual void MoreMountains.Tools.MMFader.EnableFader ( )
protectedvirtual

Enables the fader.

◆ Fade() [1/2]

virtual void MoreMountains.Tools.MMFader.Fade ( )
protectedvirtual

Fades the canvasgroup towards its target alpha

◆ Fade() [2/2]

virtual void MoreMountains.Tools.MMFader.Fade ( float  targetAlpha,
float  duration,
MMTweenType  curve,
bool  ignoreTimeScale 
)
virtual

Use this method to fade towards the specified target alpha

Parameters
targetAlpha
duration
curve
ignoreTimeScale

◆ FadeIn()

virtual void MoreMountains.Tools.MMFader.FadeIn ( float  duration,
MMTweenType  curve,
bool  ignoreTimeScale = true 
)
virtual

Use this method to cause a fade in over the specified duration and curve

Parameters
duration
curve
ignoreTimeScale

◆ FadeIn1Second()

virtual void MoreMountains.Tools.MMFader.FadeIn1Second ( )
protectedvirtual

Test method triggered by an inspector button

◆ FadeOut()

virtual void MoreMountains.Tools.MMFader.FadeOut ( float  duration,
MMTweenType  curve,
bool  ignoreTimeScale = true 
)
virtual

Use this method to cause a fade out over the specified duration and curve

Parameters
duration
curve
ignoreTimeScale

◆ FadeOut1Second()

virtual void MoreMountains.Tools.MMFader.FadeOut1Second ( )
protectedvirtual

Test method triggered by an inspector button

◆ Initialization()

virtual void MoreMountains.Tools.MMFader.Initialization ( )
protectedvirtual

On init, we grab our components, and disable/hide everything

◆ OnDisable()

virtual void MoreMountains.Tools.MMFader.OnDisable ( )
protectedvirtual

On disable, we stop listening to events

◆ OnEnable()

virtual void MoreMountains.Tools.MMFader.OnEnable ( )
protectedvirtual

On enable, we start listening to events

◆ OnMMEvent() [1/4]

virtual void MoreMountains.Tools.MMFader.OnMMEvent ( MMFadeEvent  fadeEvent)
virtual

When catching a fade event, we fade our image in or out

Parameters
fadeEventFade event.

◆ OnMMEvent() [2/4]

virtual void MoreMountains.Tools.MMFader.OnMMEvent ( MMFadeInEvent  fadeEvent)
virtual

When catching an MMFadeInEvent, we fade our image in

Parameters
fadeEventFade event.

◆ OnMMEvent() [3/4]

virtual void MoreMountains.Tools.MMFader.OnMMEvent ( MMFadeOutEvent  fadeEvent)
virtual

When catching an MMFadeOutEvent, we fade our image out

Parameters
fadeEventFade event.

◆ OnMMEvent() [4/4]

virtual void MoreMountains.Tools.MMFader.OnMMEvent ( MMFadeStopEvent  fadeStopEvent)
virtual

When catching an MMFadeStopEvent, we stop our fade

Parameters
fadeEventFade event.

◆ ResetFader()

virtual void MoreMountains.Tools.MMFader.ResetFader ( )
protectedvirtual

Test method triggered by an inspector button

◆ StartFading()

virtual void MoreMountains.Tools.MMFader.StartFading ( float  initialAlpha,
float  endAlpha,
float  duration,
MMTweenType  curve,
bool  ignoreTimeScale 
)
protectedvirtual

Starts fading this fader from the specified initial alpha to the target

Parameters
initialAlpha
endAlpha
duration
curve
id
ignoreTimeScale

◆ StopFading()

virtual void MoreMountains.Tools.MMFader.StopFading ( )
protectedvirtual

Stops the fading.

◆ Update()

virtual void MoreMountains.Tools.MMFader.Update ( )
protectedvirtual

On Update, we update our alpha

Member Data Documentation

◆ _canvasGroup

CanvasGroup MoreMountains.Tools.MMFader._canvasGroup
protected

◆ _currentCurve

MMTweenType MoreMountains.Tools.MMFader._currentCurve
protected

◆ _currentDuration

float MoreMountains.Tools.MMFader._currentDuration
protected

◆ _currentTargetAlpha

float MoreMountains.Tools.MMFader._currentTargetAlpha
protected

◆ _fadeStartedAt

float MoreMountains.Tools.MMFader._fadeStartedAt
protected

◆ _fading

bool MoreMountains.Tools.MMFader._fading = false
protected

◆ _frameCountOne

bool MoreMountains.Tools.MMFader._frameCountOne
protected

◆ _initialAlpha

float MoreMountains.Tools.MMFader._initialAlpha
protected

◆ ActiveAlpha

float MoreMountains.Tools.MMFader.ActiveAlpha = 1f

the opacity the fader should be at when active

◆ CanFadeToCurrentAlpha

bool MoreMountains.Tools.MMFader.CanFadeToCurrentAlpha = true

whether or not this fader can cause a fade if the requested final alpha is the same as the current one

◆ DebugToolbar

bool MoreMountains.Tools.MMFader.DebugToolbar

◆ DefaultDuration

float MoreMountains.Tools.MMFader.DefaultDuration = 0.2f

the default duration of the fade in/out

◆ DefaultTween

MMTweenType MoreMountains.Tools.MMFader.DefaultTween = new MMTweenType(MMTween.MMTweenCurve.LinearTween)

the default curve to use for this fader

◆ ForcedInitState

ForcedInitStates MoreMountains.Tools.MMFader.ForcedInitState = ForcedInitStates.Inactive

determines whether a state should be forced on init

◆ ID

int MoreMountains.Tools.MMFader.ID

the ID for this fader (0 is default), set more IDs if you need more than one fader

◆ IgnoreTimescale

bool MoreMountains.Tools.MMFader.IgnoreTimescale = true

whether or not the fade should happen in unscaled time

◆ InactiveAlpha

float MoreMountains.Tools.MMFader.InactiveAlpha = 0f

the opacity the fader should be at when inactive

◆ ShouldBlockRaycasts

bool MoreMountains.Tools.MMFader.ShouldBlockRaycasts = false

whether or not the fader should block raycasts when visible


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