TopDown Engine v4.5
Loading...
Searching...
No Matches
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< T > MoreMountains.Tools.MMEventListener< T > MoreMountains.Tools.MMEventListener< T > MoreMountains.Tools.MMEventListener< T > MoreMountains.Tools.MMEventListenerBase MoreMountains.Tools.MMEventListenerBase MoreMountains.Tools.MMEventListenerBase

Public Member Functions

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

Public Attributes

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

Protected Member Functions

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

Protected Attributes

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

Properties

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

Additional Inherited Members

Static Protected Attributes inherited from MoreMountains.Tools.MMPersistentSingleton< T >
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< T >.

◆ 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:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Managers/GameManager.cs