Inventory Engine v4.2
Loading...
Searching...
No Matches
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...

Inherits MoreMountains.Tools.MMMonoBehaviour, MoreMountains.Tools.MMEventListener< T >, MoreMountains.Tools.MMEventListener< T >, MoreMountains.Tools.MMEventListener< T >, and MoreMountains.Tools.MMEventListener< T >.

Public Types

enum  ForcedInitStates { None , Active , Inactive }

Public Member Functions

virtual void OnMMEvent (MMFadeEvent fadeEvent)
 When catching a fade event, we fade our image in or out.
virtual void OnMMEvent (MMFadeInEvent fadeEvent)
 When catching an MMFadeInEvent, we fade our image in.
virtual void OnMMEvent (MMFadeOutEvent fadeEvent)
 When catching an MMFadeOutEvent, we fade our image out.
virtual void Fade (float targetAlpha, float duration, MMTweenType curve, bool ignoreTimeScale)
 Use this method to fade towards the specified target alpha.
virtual void FadeIn (float duration, MMTweenType curve, bool ignoreTimeScale=true)
 Use this method to cause a fade in over the specified duration and curve.
virtual void FadeOut (float duration, MMTweenType curve, bool ignoreTimeScale=true)
 Use this method to cause a fade out over the specified duration and curve.
virtual void OnMMEvent (MMFadeStopEvent fadeStopEvent)
 When catching an MMFadeStopEvent, we stop our fade.
Public Member Functions inherited from MoreMountains.Tools.MMEventListener< T >
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
float InactiveAlpha = 0f
 the opacity the fader should be at when inactive
float ActiveAlpha = 1f
 the opacity the fader should be at when active
ForcedInitStates ForcedInitState = ForcedInitStates.Inactive
 determines whether a state should be forced on init
float DefaultDuration = 0.2f
 the default duration of the fade in/out
MMTweenType DefaultTween = new MMTweenType(MMTween.MMTweenCurve.LinearTween)
 the default curve to use for this fader
bool IgnoreTimescale = true
 whether or not the fade should happen in unscaled time
bool CanFadeToCurrentAlpha = true
 whether or not this fader can cause a fade if the requested final alpha is the same as the current one
bool ShouldBlockRaycasts = false
 whether or not the fader should block raycasts when visible
bool DebugToolbar

Protected Member Functions

virtual void ResetFader ()
 Test method triggered by an inspector button.
virtual void DefaultFade ()
 Test method triggered by an inspector button.
virtual void FadeIn1Second ()
 Test method triggered by an inspector button.
virtual void FadeOut1Second ()
 Test method triggered by an inspector button.
virtual void Awake ()
 On Start, we initialize our fader.
virtual void Initialization ()
 On init, we grab our components, and disable/hide everything.
virtual void Update ()
 On Update, we update our alpha.
virtual void Fade ()
 Fades the canvasgroup towards its target alpha.
virtual void StopFading ()
 Stops the fading.
virtual void DisableFader ()
 Disables the fader.
virtual void EnableFader ()
 Enables the fader.
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.
virtual void OnEnable ()
 On enable, we start listening to events.
virtual void OnDisable ()
 On disable, we stop listening to events.

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: