Inventory Engine v4.2
Loading...
Searching...
No Matches
MoreMountains.Feedbacks.MMTimeManager Class Reference

Put this component in your scene and it'll catch MMFreezeFrameEvents and MMTimeScaleEvents, allowing you to control the flow of time. More...

Inherits MoreMountains.Tools.MMSingleton< T >.

Public Member Functions

virtual void PreInitialization ()
 We initialize our stack.
virtual void Initialization ()
 On init we store our initial timescales and apply the normal timescale.
virtual void ResetTimeScale ()
 Resets the time scale to the stored normal time scale.
virtual void Unfreeze ()
 Resets the time scale to the last saved time scale.
virtual void SetTimeScaleTo (float newNormalTimeScale)
 Sets the time scale to the specified value, instantly.
virtual void OnTimeScaleEvent (MMTimeScaleMethods timeScaleMethod, float timeScale, float duration, bool lerp, float lerpSpeed, bool infinite, MMTimeScaleLerpModes timeScaleLerpMode=MMTimeScaleLerpModes.Speed, MMTweenType timeScaleLerpCurve=null, float timeScaleLerpDuration=0.2f, bool timeScaleLerpOnUnfreeze=false, MMTweenType timeScaleLerpCurveOnUnfreeze=null, float timeScaleLerpDurationOnUnfreeze=0.2f)
 Catches TimeScaleEvents and acts on them.
virtual void OnMMFreezeFrameEvent (float duration)
 When getting a freeze frame event we stop the time.

Public Attributes

float NormalTimeScale = 1f
 The reference time scale, to which the system will go back to after all time is changed.
bool UpdateTimescale = true
 whether or not to update Time.timeScale when changing time scale
bool UpdateFixedDeltaTime = true
 whether or not to update Time.fixedDeltaTime when changing time scale
bool UpdateMaximumDeltaTime = true
 whether or not to update Time.maximumDeltaTime when changing time scale
float CurrentTimeScale = 1f
 the current, real time, time scale
float TargetTimeScale = 1f
 the time scale the system is lerping towards
bool TestButton
 a test button for the inspector

Protected Member Functions

virtual void TestButtonToSlowDownTime ()
 A method used from the inspector to test the system.
override void Awake ()
 On start we initialize our stack.
virtual void Start ()
 On Start we apply our timescale.
virtual void Update ()
 On Update, applies the time scale and resets it if needed.
virtual void ApplyTimeScale (float newValue)
 Modifies the time scale and time attributes to match the new time scale.
virtual void SetTimeScale (float newTimeScale)
 Resets all stacked time scale changes and simply sets the time scale, until further changes.
virtual void SetTimeScale (TimeScaleProperties timeScaleProperties)
 Sets the time scale for the specified properties (duration, time scale, lerp or not, and lerp speed)
Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< T >
virtual void InitializeSingleton ()
 Initializes the singleton.

Static Protected Member Functions

static void InitializeStatics ()
 Statics initialization to support enter play modes.

Protected Attributes

Stack< TimeScaleProperties_timeScaleProperties
TimeScaleProperties _currentProperty
TimeScaleProperties _resetProperty
float _initialFixedDeltaTime = 0f
float _initialMaximumDeltaTime = 0f
float _startedAt
bool _lerpingBackToNormal = false
float _timeScaleLastTime = float.NegativeInfinity
float _initialTimeScale = 1f

Additional Inherited Members

Static Public Member Functions inherited from MoreMountains.Tools.MMSingleton< T >
static T TryGetInstance ()
Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< T >
static T _instance
Properties inherited from MoreMountains.Tools.MMSingleton< T >
static bool HasInstance [get]
static T Current [get]
static T Instance [get]
 Singleton design pattern.

Detailed Description

Put this component in your scene and it'll catch MMFreezeFrameEvents and MMTimeScaleEvents, allowing you to control the flow of time.

Member Function Documentation

◆ ApplyTimeScale()

virtual void MoreMountains.Feedbacks.MMTimeManager.ApplyTimeScale ( float newValue)
protectedvirtual

Modifies the time scale and time attributes to match the new time scale.

Parameters
newValue

◆ Awake()

override void MoreMountains.Feedbacks.MMTimeManager.Awake ( )
protectedvirtual

On start we initialize our stack.

Reimplemented from MoreMountains.Tools.MMSingleton< T >.

◆ Initialization()

virtual void MoreMountains.Feedbacks.MMTimeManager.Initialization ( )
virtual

On init we store our initial timescales and apply the normal timescale.

◆ InitializeStatics()

void MoreMountains.Feedbacks.MMTimeManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes.

◆ OnMMFreezeFrameEvent()

virtual void MoreMountains.Feedbacks.MMTimeManager.OnMMFreezeFrameEvent ( float duration)
virtual

When getting a freeze frame event we stop the time.

Parameters
freezeFrameEventFreeze frame event.

◆ OnTimeScaleEvent()

virtual void MoreMountains.Feedbacks.MMTimeManager.OnTimeScaleEvent ( MMTimeScaleMethods timeScaleMethod,
float timeScale,
float duration,
bool lerp,
float lerpSpeed,
bool infinite,
MMTimeScaleLerpModes timeScaleLerpMode = MMTimeScaleLerpModes::Speed,
MMTweenType timeScaleLerpCurve = null,
float timeScaleLerpDuration = 0::2f,
bool timeScaleLerpOnUnfreeze = false,
MMTweenType timeScaleLerpCurveOnUnfreeze = null,
float timeScaleLerpDurationOnUnfreeze = 0::2f )
virtual

Catches TimeScaleEvents and acts on them.

Parameters
timeScaleEventMMTimeScaleEvent event.

◆ PreInitialization()

virtual void MoreMountains.Feedbacks.MMTimeManager.PreInitialization ( )
virtual

We initialize our stack.

◆ ResetTimeScale()

virtual void MoreMountains.Feedbacks.MMTimeManager.ResetTimeScale ( )
virtual

Resets the time scale to the stored normal time scale.

◆ SetTimeScale() [1/2]

virtual void MoreMountains.Feedbacks.MMTimeManager.SetTimeScale ( float newTimeScale)
protectedvirtual

Resets all stacked time scale changes and simply sets the time scale, until further changes.

Parameters
newTimeScaleNew time scale.

◆ SetTimeScale() [2/2]

virtual void MoreMountains.Feedbacks.MMTimeManager.SetTimeScale ( TimeScaleProperties timeScaleProperties)
protectedvirtual

Sets the time scale for the specified properties (duration, time scale, lerp or not, and lerp speed)

Parameters
timeScalePropertiesTime scale properties.

◆ SetTimeScaleTo()

virtual void MoreMountains.Feedbacks.MMTimeManager.SetTimeScaleTo ( float newNormalTimeScale)
virtual

Sets the time scale to the specified value, instantly.

Parameters
newNormalTimeScaleNew normal time scale.

◆ Start()

virtual void MoreMountains.Feedbacks.MMTimeManager.Start ( )
protectedvirtual

On Start we apply our timescale.

◆ TestButtonToSlowDownTime()

virtual void MoreMountains.Feedbacks.MMTimeManager.TestButtonToSlowDownTime ( )
protectedvirtual

A method used from the inspector to test the system.

◆ Unfreeze()

virtual void MoreMountains.Feedbacks.MMTimeManager.Unfreeze ( )
virtual

Resets the time scale to the last saved time scale.

◆ Update()

virtual void MoreMountains.Feedbacks.MMTimeManager.Update ( )
protectedvirtual

On Update, applies the time scale and resets it if needed.

Member Data Documentation

◆ _currentProperty

TimeScaleProperties MoreMountains.Feedbacks.MMTimeManager._currentProperty
protected

◆ _initialFixedDeltaTime

float MoreMountains.Feedbacks.MMTimeManager._initialFixedDeltaTime = 0f
protected

◆ _initialMaximumDeltaTime

float MoreMountains.Feedbacks.MMTimeManager._initialMaximumDeltaTime = 0f
protected

◆ _initialTimeScale

float MoreMountains.Feedbacks.MMTimeManager._initialTimeScale = 1f
protected

◆ _lerpingBackToNormal

bool MoreMountains.Feedbacks.MMTimeManager._lerpingBackToNormal = false
protected

◆ _resetProperty

TimeScaleProperties MoreMountains.Feedbacks.MMTimeManager._resetProperty
protected

◆ _startedAt

float MoreMountains.Feedbacks.MMTimeManager._startedAt
protected

◆ _timeScaleLastTime

float MoreMountains.Feedbacks.MMTimeManager._timeScaleLastTime = float.NegativeInfinity
protected

◆ _timeScaleProperties

Stack<TimeScaleProperties> MoreMountains.Feedbacks.MMTimeManager._timeScaleProperties
protected

◆ CurrentTimeScale

float MoreMountains.Feedbacks.MMTimeManager.CurrentTimeScale = 1f

the current, real time, time scale

◆ NormalTimeScale

float MoreMountains.Feedbacks.MMTimeManager.NormalTimeScale = 1f

The reference time scale, to which the system will go back to after all time is changed.

◆ TargetTimeScale

float MoreMountains.Feedbacks.MMTimeManager.TargetTimeScale = 1f

the time scale the system is lerping towards

◆ TestButton

bool MoreMountains.Feedbacks.MMTimeManager.TestButton

a test button for the inspector

◆ UpdateFixedDeltaTime

bool MoreMountains.Feedbacks.MMTimeManager.UpdateFixedDeltaTime = true

whether or not to update Time.fixedDeltaTime when changing time scale

◆ UpdateMaximumDeltaTime

bool MoreMountains.Feedbacks.MMTimeManager.UpdateMaximumDeltaTime = true

whether or not to update Time.maximumDeltaTime when changing time scale

◆ UpdateTimescale

bool MoreMountains.Feedbacks.MMTimeManager.UpdateTimescale = true

whether or not to update Time.timeScale when changing time scale


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