Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.TimeManager Class Reference

Handles time related operations such as getting the current frame time. This implementation is a simple wrapper on delta time that limits the maximum time of a frame to a user defined maximum value. More...

Inheritance diagram for PlatformerPro.TimeManager:
PlatformerPro.PlatformerProMonoBehaviour PlatformerPro.TimeManagerWithTimer

Public Member Functions

virtual void OnGamePaused ()
 Raises the game paused event. More...
 
virtual void OnGameUnPaused ()
 Raises the game unpaused event. More...
 
void TogglePause (bool setTimeScale)
 Pause the game. More...
 
void Pause (bool setTimeScale, bool skipPauseMenu=false)
 Pause the game. More...
 
void UnPause (bool setTimeScale)
 Unpause the game. More...
 
void UnPause (float newTimeScale)
 Unpause the game. More...
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual void Validate (PlatformerProMonoBehaviour myTarget)
 Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More...
 

Public Attributes

float maximumFrameTime = DefaultMaximumFrameTime
 The maximum permissable frame time. More...
 

Static Public Attributes

const float DefaultMaximumFrameTime = 0.033f
 The default maximum frame time. More...
 

Static Protected Member Functions

static void CreateNewTimeManager ()
 Creates a new time manager. More...
 

Protected Attributes

UIPauseMenu pauseMenu
 The pause menu. More...
 

Static Protected Attributes

static bool paused
 Are we paused? More...
 
static TimeManager instance
 The time manager instance. More...
 

Properties

override string Header [get]
 Gets the header string used to describe the component. More...
 
static float FrameTime [get]
 Gets the frame time. More...
 
static float MaxFrameTime [get]
 Gets the maximum possible frame time. More...
 
static TimeManager Instance [get, protected set]
 Gets a static reference to the time manager if one exists. More...
 
static TimeManager SafeInstance [get]
 Gets the instance only if it exists will not create a new one. Safe to call from OnDestroy while unregistering listeners. More...
 
bool Paused [get]
 Are we paused? More...
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual string Header [get]
 Gets the header string used to describe the component. More...
 
virtual string DocLink [get]
 Gets a link to documentation site. More...
 
virtual string VideoLink [get]
 Gets a link to a youtube video. More...
 
virtual string Deprecated [get]
 If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More...
 

Events

System.EventHandler< EmptyEventArgsGamePaused
 Event for pause. More...
 
System.EventHandler< System.EventArgs > GameUnPaused
 Event for unpause. More...
 

Detailed Description

Handles time related operations such as getting the current frame time. This implementation is a simple wrapper on delta time that limits the maximum time of a frame to a user defined maximum value.

Member Function Documentation

◆ CreateNewTimeManager()

static void PlatformerPro.TimeManager.CreateNewTimeManager ( )
staticprotected

Creates a new time manager.

◆ OnGamePaused()

virtual void PlatformerPro.TimeManager.OnGamePaused ( )
virtual

Raises the game paused event.

◆ OnGameUnPaused()

virtual void PlatformerPro.TimeManager.OnGameUnPaused ( )
virtual

Raises the game unpaused event.

◆ Pause()

void PlatformerPro.TimeManager.Pause ( bool  setTimeScale,
bool  skipPauseMenu = false 
)

Pause the game.

Parameters
setTimeScaleIf set to true then Time.timeScale will also be set to 0.

◆ TogglePause()

void PlatformerPro.TimeManager.TogglePause ( bool  setTimeScale)

Pause the game.

Parameters
setTimeScaleIf set to true then Time.timeScale will also be set to 0.

◆ UnPause() [1/2]

void PlatformerPro.TimeManager.UnPause ( bool  setTimeScale)

Unpause the game.

Parameters
setTimeScaleIf set to true then Time.timeScale will also be set to 1.

◆ UnPause() [2/2]

void PlatformerPro.TimeManager.UnPause ( float  newTimeScale)

Unpause the game.

Parameters
newTimeScaleTime.timeScale will be set to newTimeScale.

Member Data Documentation

◆ DefaultMaximumFrameTime

const float PlatformerPro.TimeManager.DefaultMaximumFrameTime = 0.033f
static

The default maximum frame time.

◆ instance

TimeManager PlatformerPro.TimeManager.instance
staticprotected

The time manager instance.

◆ maximumFrameTime

float PlatformerPro.TimeManager.maximumFrameTime = DefaultMaximumFrameTime

The maximum permissable frame time.

◆ paused

bool PlatformerPro.TimeManager.paused
staticprotected

Are we paused?

◆ pauseMenu

UIPauseMenu PlatformerPro.TimeManager.pauseMenu
protected

The pause menu.

Property Documentation

◆ FrameTime

float PlatformerPro.TimeManager.FrameTime
staticget

Gets the frame time.

◆ Header

override string PlatformerPro.TimeManager.Header
get

Gets the header string used to describe the component.

The header.

◆ Instance

TimeManager PlatformerPro.TimeManager.Instance
staticgetprotected set

Gets a static reference to the time manager if one exists.

The instance.

◆ MaxFrameTime

float PlatformerPro.TimeManager.MaxFrameTime
staticget

Gets the maximum possible frame time.

◆ Paused

bool PlatformerPro.TimeManager.Paused
get

Are we paused?

◆ SafeInstance

TimeManager PlatformerPro.TimeManager.SafeInstance
staticget

Gets the instance only if it exists will not create a new one. Safe to call from OnDestroy while unregistering listeners.

Event Documentation

◆ GamePaused

System.EventHandler<EmptyEventArgs> PlatformerPro.TimeManager.GamePaused

Event for pause.

◆ GameUnPaused

System.EventHandler<System.EventArgs> PlatformerPro.TimeManager.GameUnPaused

Event for unpause.


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