TopDown Engine  v3.6
MoreMountains.TopDownEngine.GameManager Class Reference

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

Inheritance diagram for MoreMountains.TopDownEngine.GameManager:
MoreMountains.Tools.MMPersistentSingleton< GameManager > MoreMountains.Tools.MMEventListener< MMGameEvent > MoreMountains.Tools.MMEventListener< TopDownEngineEvent > MoreMountains.Tools.MMEventListener< TopDownEnginePointEvent >

Public Member Functions

virtual void Reset ()
 this method resets the whole game manager More...
 
virtual void LoseLife ()
 Use this method to decrease the current number of lives More...
 
virtual void GainLives (int lives)
 Use this method when a life (or more) is gained More...
 
virtual void AddLives (int lives, bool increaseCurrent)
 Use this method to increase the max amount of lives, and optionnally the current amount as well More...
 
virtual void ResetLives ()
 Resets the number of lives to their initial values. More...
 
virtual void AddPoints (int pointsToAdd)
 Adds the points in parameters to the current game points. More...
 
virtual void SetPoints (int points)
 use this to set the current points to the one you pass as a parameter More...
 
virtual void Pause (PauseMethods pauseMethod=PauseMethods.PauseMenu, bool unpauseIfPaused=true)
 Pauses the game or unpauses it depending on the current state More...
 
virtual void UnPause (PauseMethods pauseMethod=PauseMethods.PauseMenu)
 Unpauses the game More...
 
virtual void StorePointsOfEntry (string levelName, int entryIndex, Character.FacingDirections facingDirection)
 Stores the points of entry for the level whose name you pass as a parameter. More...
 
virtual PointsOfEntryStorage GetPointsOfEntry (string levelName)
 Gets point of entry info for the level whose scene name you pass as a parameter More...
 
virtual void ClearPointOfEntry (string levelName)
 Clears the stored point of entry infos for the level whose name you pass as a parameter More...
 
virtual void ClearAllPointsOfEntry ()
 Clears all points of entry. More...
 
virtual void ResetAllSaves ()
 Deletes all save files More...
 
virtual void StoreSelectedCharacter (Character selectedCharacter)
 Stores the selected character for use in upcoming levels More...
 
virtual void ClearSelectedCharacter ()
 Clears the selected character. More...
 
virtual void SetPersistentCharacter (Character newCharacter)
 Sets a new persistent character More...
 
virtual void DestroyPersistentCharacter ()
 Destroys a persistent character if there's one More...
 
virtual void OnMMEvent (MMGameEvent gameEvent)
 Catches MMGameEvents and acts on them, playing the corresponding sounds More...
 
virtual void OnMMEvent (TopDownEngineEvent engineEvent)
 Catches TopDownEngineEvents and acts on them, playing the corresponding sounds More...
 
virtual void OnMMEvent (TopDownEnginePointEvent pointEvent)
 Catches TopDownEnginePointsEvents and acts on them, playing the corresponding sounds More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< MMGameEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< TopDownEngineEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< TopDownEnginePointEvent >
void OnMMEvent (T eventType)
 

Public Attributes

int TargetFrameRate = 300
 the target frame rate for the game More...
 
int MaximumLives = 0
 the maximum amount of lives the character can currently have More...
 
int CurrentLives = 0
 the current number of lives More...
 
string GameOverScene
 the name of the scene to redirect to when all lives are lost More...
 
int Points
 the current number of game points More...
 
bool PauseGameWhenInventoryOpens = true
 if this is true, the game will automatically pause when opening an inventory More...
 
List< PointsOfEntryStoragePointsOfEntry
 the list of points of entry and exit More...
 
- Public Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< GameManager >
bool AutomaticallyUnparentOnAwake
 if this is true, this singleton will auto detach if it finds itself parented on awake More...
 

Protected Member Functions

override void Awake ()
 On Awake we initialize our list of points of entry More...
 
virtual void Start ()
 On Start(), sets the target framerate to whatever's been specified More...
 
virtual void SetActiveInventoryInputManager (bool status)
 Enables the inventory input manager if found More...
 
virtual void OnEnable ()
 OnDisable, we start listening to events. More...
 
virtual void OnDisable ()
 OnDisable, we stop listening to events. More...
 
- Protected Member Functions inherited from MoreMountains.Tools.MMPersistentSingleton< GameManager >
virtual void InitializeSingleton ()
 Initializes the singleton. More...
 

Protected Attributes

bool _inventoryOpen = false
 
bool _pauseMenuOpen = false
 
InventoryInputManager _inventoryInputManager
 
int _initialMaximumLives
 
int _initialCurrentLives
 
- Protected Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< GameManager >
bool _enabled
 

Properties

virtual bool Paused [get, set]
 true if the game is currently paused More...
 
virtual bool StoredLevelMapPosition [get, set]
 
virtual Vector2 LevelMapPosition [get, set]
 the current player More...
 
virtual Character PersistentCharacter [get, set]
 the stored selected character More...
 
virtual Character StoredCharacter [get, set]
 the stored selected character More...
 
- Properties inherited from MoreMountains.Tools.MMPersistentSingleton< GameManager >
static T Instance [get]
 Singleton design pattern More...
 

Additional Inherited Members

- Static Public Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< GameManager >
static bool HasInstance
 
static T Current
 
- Static Protected Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< GameManager >
static T _instance
 

Detailed Description

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

Member Function Documentation

◆ AddLives()

virtual void MoreMountains.TopDownEngine.GameManager.AddLives ( int  lives,
bool  increaseCurrent 
)
virtual

Use this method to increase the max amount of lives, and optionnally the current amount as well

Parameters
livesLives.
increaseCurrentIf set to true increase current.

◆ AddPoints()

virtual void MoreMountains.TopDownEngine.GameManager.AddPoints ( int  pointsToAdd)
virtual

Adds the points in parameters to the current game points.

Parameters
pointsToAddPoints to add.

◆ Awake()

override void MoreMountains.TopDownEngine.GameManager.Awake ( )
protectedvirtual

On Awake we initialize our list of points of entry

Reimplemented from MoreMountains.Tools.MMPersistentSingleton< GameManager >.

◆ ClearAllPointsOfEntry()

virtual void MoreMountains.TopDownEngine.GameManager.ClearAllPointsOfEntry ( )
virtual

Clears all points of entry.

◆ ClearPointOfEntry()

virtual void MoreMountains.TopDownEngine.GameManager.ClearPointOfEntry ( string  levelName)
virtual

Clears the stored point of entry infos for the level whose name you pass as a parameter

Parameters
levelNameLevel name.

◆ ClearSelectedCharacter()

virtual void MoreMountains.TopDownEngine.GameManager.ClearSelectedCharacter ( )
virtual

Clears the selected character.

◆ DestroyPersistentCharacter()

virtual void MoreMountains.TopDownEngine.GameManager.DestroyPersistentCharacter ( )
virtual

Destroys a persistent character if there's one

◆ GainLives()

virtual void MoreMountains.TopDownEngine.GameManager.GainLives ( int  lives)
virtual

Use this method when a life (or more) is gained

Parameters
livesLives.

◆ GetPointsOfEntry()

virtual PointsOfEntryStorage MoreMountains.TopDownEngine.GameManager.GetPointsOfEntry ( string  levelName)
virtual

Gets point of entry info for the level whose scene name you pass as a parameter

Returns
The points of entry.
Parameters
levelNameLevel name.

◆ LoseLife()

virtual void MoreMountains.TopDownEngine.GameManager.LoseLife ( )
virtual

Use this method to decrease the current number of lives

◆ OnDisable()

virtual void MoreMountains.TopDownEngine.GameManager.OnDisable ( )
protectedvirtual

OnDisable, we stop listening to events.

◆ OnEnable()

virtual void MoreMountains.TopDownEngine.GameManager.OnEnable ( )
protectedvirtual

OnDisable, we start listening to events.

◆ OnMMEvent() [1/3]

virtual void MoreMountains.TopDownEngine.GameManager.OnMMEvent ( MMGameEvent  gameEvent)
virtual

Catches MMGameEvents and acts on them, playing the corresponding sounds

Parameters
gameEventMMGameEvent event.

◆ OnMMEvent() [2/3]

virtual void MoreMountains.TopDownEngine.GameManager.OnMMEvent ( TopDownEngineEvent  engineEvent)
virtual

Catches TopDownEngineEvents and acts on them, playing the corresponding sounds

Parameters
engineEventTopDownEngineEvent event.

◆ OnMMEvent() [3/3]

virtual void MoreMountains.TopDownEngine.GameManager.OnMMEvent ( TopDownEnginePointEvent  pointEvent)
virtual

Catches TopDownEnginePointsEvents and acts on them, playing the corresponding sounds

Parameters
pointEventTopDownEnginePointEvent event.

◆ Pause()

virtual void MoreMountains.TopDownEngine.GameManager.Pause ( PauseMethods  pauseMethod = PauseMethods.PauseMenu,
bool  unpauseIfPaused = true 
)
virtual

Pauses the game or unpauses it depending on the current state

◆ Reset()

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

this method resets the whole game manager

◆ ResetAllSaves()

virtual void MoreMountains.TopDownEngine.GameManager.ResetAllSaves ( )
virtual

Deletes all save files

◆ ResetLives()

virtual void MoreMountains.TopDownEngine.GameManager.ResetLives ( )
virtual

Resets the number of lives to their initial values.

◆ SetActiveInventoryInputManager()

virtual void MoreMountains.TopDownEngine.GameManager.SetActiveInventoryInputManager ( bool  status)
protectedvirtual

Enables the inventory input manager if found

Parameters
status

◆ SetPersistentCharacter()

virtual void MoreMountains.TopDownEngine.GameManager.SetPersistentCharacter ( Character  newCharacter)
virtual

Sets a new persistent character

Parameters
newCharacter

◆ SetPoints()

virtual void MoreMountains.TopDownEngine.GameManager.SetPoints ( int  points)
virtual

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

Parameters
pointsPoints.

◆ Start()

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

On Start(), sets the target framerate to whatever's been specified

◆ StorePointsOfEntry()

virtual void MoreMountains.TopDownEngine.GameManager.StorePointsOfEntry ( string  levelName,
int  entryIndex,
Character.FacingDirections  facingDirection 
)
virtual

Stores the points of entry for the level whose name you pass as a parameter.

Parameters
levelNameLevel name.
entryIndexEntry index.
exitIndexExit index.

◆ StoreSelectedCharacter()

virtual void MoreMountains.TopDownEngine.GameManager.StoreSelectedCharacter ( Character  selectedCharacter)
virtual

Stores the selected character for use in upcoming levels

Parameters
selectedCharacterSelected character.

◆ UnPause()

virtual void MoreMountains.TopDownEngine.GameManager.UnPause ( PauseMethods  pauseMethod = PauseMethods.PauseMenu)
virtual

Unpauses the game

Member Data Documentation

◆ _initialCurrentLives

int MoreMountains.TopDownEngine.GameManager._initialCurrentLives
protected

◆ _initialMaximumLives

int MoreMountains.TopDownEngine.GameManager._initialMaximumLives
protected

◆ _inventoryInputManager

InventoryInputManager MoreMountains.TopDownEngine.GameManager._inventoryInputManager
protected

◆ _inventoryOpen

bool MoreMountains.TopDownEngine.GameManager._inventoryOpen = false
protected

◆ _pauseMenuOpen

bool MoreMountains.TopDownEngine.GameManager._pauseMenuOpen = false
protected

◆ CurrentLives

int MoreMountains.TopDownEngine.GameManager.CurrentLives = 0

the current number of lives

◆ GameOverScene

string MoreMountains.TopDownEngine.GameManager.GameOverScene

the name of the scene to redirect to when all lives are lost

◆ MaximumLives

int MoreMountains.TopDownEngine.GameManager.MaximumLives = 0

the maximum amount of lives the character can currently have

◆ PauseGameWhenInventoryOpens

bool MoreMountains.TopDownEngine.GameManager.PauseGameWhenInventoryOpens = true

if this is true, the game will automatically pause when opening an inventory

◆ Points

int MoreMountains.TopDownEngine.GameManager.Points

the current number of game points

◆ PointsOfEntry

List<PointsOfEntryStorage> MoreMountains.TopDownEngine.GameManager.PointsOfEntry

the list of points of entry and exit

◆ TargetFrameRate

int MoreMountains.TopDownEngine.GameManager.TargetFrameRate = 300

the target frame rate for the game

Property Documentation

◆ LevelMapPosition

virtual Vector2 MoreMountains.TopDownEngine.GameManager.LevelMapPosition
getset

the current player

◆ Paused

virtual bool MoreMountains.TopDownEngine.GameManager.Paused
getset

true if the game is currently paused

◆ PersistentCharacter

virtual Character MoreMountains.TopDownEngine.GameManager.PersistentCharacter
getset

the stored selected character

◆ StoredCharacter

virtual Character MoreMountains.TopDownEngine.GameManager.StoredCharacter
getset

the stored selected character

◆ StoredLevelMapPosition

virtual bool MoreMountains.TopDownEngine.GameManager.StoredLevelMapPosition
getset

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