Infinite Runner Engine v1.9
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | Events | List of all members
MoreMountains.InfiniteRunnerEngine.GameManager Class Reference

The game manager is a persistent singleton that handles points and time More...

Inheritance diagram for MoreMountains.InfiniteRunnerEngine.GameManager:
MoreMountains.Tools.MMSingleton< GameManager >

Public Types

enum  GameStatus {
  BeforeGameStart , GameInProgress , Paused , GameOver ,
  LifeLost , GoalReached
}
 the various states the game can be in More...
 

Public Member Functions

delegate void GameManagerInspectorRedraw ()
 
virtual void SetPointsPerSecond (float newPointsPerSecond)
 
virtual void SetStatus (GameStatus newStatus)
 Sets the status. Status can be accessed by other classes to check if the game is paused, starting, etc More...
 
virtual void Reset ()
 this method resets the whole game manager More...
 
virtual void AutoIncrementScore (bool status)
 Starts or stops the autoincrement of the score More...
 
virtual void AddPoints (float pointsToAdd)
 Adds the points in parameters to the current game points. More...
 
virtual void SetPoints (float points)
 use this to set the current points to the one you pass as a parameter More...
 
virtual void SetLives (int lives)
 use this to set the number of lives currently available More...
 
virtual void LoseLives (int lives)
 use this to remove lives from the current amount More...
 
virtual void SetTimeScale (float newTimeScale)
 sets the timescale to the one in parameters More...
 
virtual void ResetTimeScale ()
 Resets the time scale to the last saved time scale. More...
 
virtual void Pause ()
 Pauses the game More...
 
virtual void UnPause ()
 Unpauses the game More...
 

Public Attributes

int TotalLives = 3
 
float TimeScale = 1
 the current time scale More...
 

Protected Member Functions

virtual void Start ()
 Initialization More...
 
virtual IEnumerator IncrementScore ()
 Each 0.01 second, increments the score by 1/100th of the number of points it's supposed to increase each second More...
 
virtual void OnApplicationQuit ()
 
- Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< GameManager >
virtual void Awake ()
 On awake, we initialize our instance. Make sure to call base.Awake() in override if you need awake. More...
 

Protected Attributes

float _savedTimeScale
 
IEnumerator _scoreCoroutine
 
float _pointsPerSecond
 
GameStatus _statusBeforePause
 
Coroutine _autoIncrementCoroutine
 

Properties

int CurrentLives [getprotected set]
 The current number of lives. More...
 
float Points [getprotected set]
 the current number of game points More...
 
GameStatus Status [getprotected set]
 the current status of the game More...
 
- Properties inherited from MoreMountains.Tools.MMSingleton< GameManager >
static bool HasInstance [get]
 
static T Current [get]
 
static T Instance [get]
 Singleton design pattern More...
 

Events

GameManagerInspectorRedraw GameManagerInspectorNeedRedraw
 

Additional Inherited Members

- Static Public Member Functions inherited from MoreMountains.Tools.MMSingleton< GameManager >
static T TryGetInstance ()
 
- Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< GameManager >
static T _instance
 

Detailed Description

The game manager is a persistent singleton that handles points and time

Member Enumeration Documentation

◆ GameStatus

the various states the game can be in

Enumerator
BeforeGameStart 
GameInProgress 
Paused 
GameOver 
LifeLost 
GoalReached 

Member Function Documentation

◆ AddPoints()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.AddPoints ( float  pointsToAdd)
virtual

Adds the points in parameters to the current game points.

Parameters
pointsToAddPoints to add.

◆ AutoIncrementScore()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.AutoIncrementScore ( bool  status)
virtual

Starts or stops the autoincrement of the score

Parameters
statusIf set to true autoincrements the score, if set to false, stops the autoincrementation.

◆ GameManagerInspectorRedraw()

delegate void MoreMountains.InfiniteRunnerEngine.GameManager.GameManagerInspectorRedraw ( )

◆ IncrementScore()

virtual IEnumerator MoreMountains.InfiniteRunnerEngine.GameManager.IncrementScore ( )
protectedvirtual

Each 0.01 second, increments the score by 1/100th of the number of points it's supposed to increase each second

Returns
The score.

◆ LoseLives()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.LoseLives ( int  lives)
virtual

use this to remove lives from the current amount

Parameters
livesthe number of lives you want to lose.

◆ OnApplicationQuit()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.OnApplicationQuit ( )
protectedvirtual

◆ Pause()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.Pause ( )
virtual

Pauses the game

◆ Reset()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.Reset ( )
virtual

this method resets the whole game manager

◆ ResetTimeScale()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.ResetTimeScale ( )
virtual

Resets the time scale to the last saved time scale.

◆ SetLives()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.SetLives ( int  lives)
virtual

use this to set the number of lives currently available

Parameters
livesthe new number of lives.

◆ SetPoints()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.SetPoints ( float  points)
virtual

use this to set the current points to the one you pass as a parameter

Parameters
pointsPoints.

◆ SetPointsPerSecond()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.SetPointsPerSecond ( float  newPointsPerSecond)
virtual

◆ SetStatus()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.SetStatus ( GameStatus  newStatus)
virtual

Sets the status. Status can be accessed by other classes to check if the game is paused, starting, etc

Parameters
newStatusNew status.

◆ SetTimeScale()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.SetTimeScale ( float  newTimeScale)
virtual

sets the timescale to the one in parameters

Parameters
newTimeScaleNew time scale.

◆ Start()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.Start ( )
protectedvirtual

Initialization

◆ UnPause()

virtual void MoreMountains.InfiniteRunnerEngine.GameManager.UnPause ( )
virtual

Unpauses the game

Member Data Documentation

◆ _autoIncrementCoroutine

Coroutine MoreMountains.InfiniteRunnerEngine.GameManager._autoIncrementCoroutine
protected

◆ _pointsPerSecond

float MoreMountains.InfiniteRunnerEngine.GameManager._pointsPerSecond
protected

◆ _savedTimeScale

float MoreMountains.InfiniteRunnerEngine.GameManager._savedTimeScale
protected

◆ _scoreCoroutine

IEnumerator MoreMountains.InfiniteRunnerEngine.GameManager._scoreCoroutine
protected

◆ _statusBeforePause

GameStatus MoreMountains.InfiniteRunnerEngine.GameManager._statusBeforePause
protected

◆ TimeScale

float MoreMountains.InfiniteRunnerEngine.GameManager.TimeScale = 1

the current time scale

◆ TotalLives

int MoreMountains.InfiniteRunnerEngine.GameManager.TotalLives = 3

the number of lives the player gets (you lose a life when your character (or your characters all) die. lose all lives you lose the game and your points.

Property Documentation

◆ CurrentLives

int MoreMountains.InfiniteRunnerEngine.GameManager.CurrentLives
getprotected set

The current number of lives.

◆ Points

float MoreMountains.InfiniteRunnerEngine.GameManager.Points
getprotected set

the current number of game points

◆ Status

GameStatus MoreMountains.InfiniteRunnerEngine.GameManager.Status
getprotected set

the current status of the game

Event Documentation

◆ GameManagerInspectorNeedRedraw

GameManagerInspectorRedraw MoreMountains.InfiniteRunnerEngine.GameManager.GameManagerInspectorNeedRedraw

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