Corgi Engine  v8.8
MoreMountains.CorgiEngine.GameManager Class Reference

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

Inheritance diagram for MoreMountains.CorgiEngine.GameManager:
MoreMountains.Tools.MMPersistentSingleton< GameManager > MoreMountains.Tools.MMEventListener< MMGameEvent > MoreMountains.Tools.MMEventListener< CorgiEngineEvent > MoreMountains.Tools.MMEventListener< CorgiEnginePointsEvent >

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)
 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 ResetAllSaves ()
 Deletes all save files 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 SetPersistentCharacter (Character newCharacter)
 Sets a new persistent character More...
 
virtual void DestroyPersistentCharacter ()
 Destroys a persistent character if there's one More...
 
virtual void StoreSelectedCharacter (Character selectedCharacter)
 Stores the selected character for use in upcoming levels More...
 
virtual void ClearStoredCharacter ()
 Clears the selected character. More...
 
virtual void OnMMEvent (MMGameEvent gameEvent)
 Catches MMGameEvents and acts on them, playing the corresponding sounds More...
 
virtual void OnMMEvent (CorgiEngineEvent engineEvent)
 Catches CorgiEngineEvents and acts on them, playing the corresponding sounds More...
 
virtual void OnMMEvent (CorgiEnginePointsEvent pointEvent)
 Catches CorgiEnginePointsEvents 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< CorgiEngineEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< CorgiEnginePointsEvent >
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...
 
bool ResetLivesOnGameOver = true
 if this is true, lives will be reset on game over More...
 
bool ResetPersistentCharacterOnGameOver = true
 if this is true, the persistent character will be cleared on game over More...
 
bool ResetStoredCharacterOnGameOver = true
 if this is true, the stored character will be cleared on game over More...
 
string GameOverScene
 the name of the scene to redirect to when all lives are lost 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 check if there's already a copy of the object in the scene. If there's one, we destroy it. More...
 
virtual void Start ()
 On Start(), sets the target framerate to whatever's been specified More...
 
virtual void SetActiveInventoryInputManager (bool status)
 
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

int Points [get]
 the current number of game points More...
 
bool Paused [get, set]
 true if the game is currently paused More...
 
bool StoredLevelMapPosition [get, set]
 
Vector2 LevelMapPosition [get, set]
 the current player More...
 
Character StoredCharacter [get, set]
 the stored selected character More...
 
Character PersistentCharacter [get, set]
 the stored selected character More...
 
List< PointsOfEntryStoragePointsOfEntry [get, set]
 the list of points of entry and exit 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.CorgiEngine.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.CorgiEngine.GameManager.AddPoints ( int  pointsToAdd)
virtual

Adds the points in parameters to the current game points.

Parameters
pointsToAddPoints to add.

◆ Awake()

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

On awake, we check if there's already a copy of the object in the scene. If there's one, we destroy it.

Reimplemented from MoreMountains.Tools.MMPersistentSingleton< GameManager >.

◆ ClearAllPointsOfEntry()

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

Clears all points of entry.

◆ ClearPointOfEntry()

virtual void MoreMountains.CorgiEngine.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.

◆ ClearStoredCharacter()

virtual void MoreMountains.CorgiEngine.GameManager.ClearStoredCharacter ( )
virtual

Clears the selected character.

◆ DestroyPersistentCharacter()

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

Destroys a persistent character if there's one

◆ GainLives()

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

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

Parameters
livesLives.

◆ GetPointsOfEntry()

virtual PointsOfEntryStorage MoreMountains.CorgiEngine.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.CorgiEngine.GameManager.LoseLife ( )
virtual

Use this method to decrease the current number of lives

◆ OnDisable()

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

OnDisable, we stop listening to events.

◆ OnEnable()

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

OnDisable, we start listening to events.

◆ OnMMEvent() [1/3]

virtual void MoreMountains.CorgiEngine.GameManager.OnMMEvent ( CorgiEngineEvent  engineEvent)
virtual

Catches CorgiEngineEvents and acts on them, playing the corresponding sounds

Parameters
engineEventCorgiEngineEvent event.

◆ OnMMEvent() [2/3]

virtual void MoreMountains.CorgiEngine.GameManager.OnMMEvent ( CorgiEnginePointsEvent  pointEvent)
virtual

Catches CorgiEnginePointsEvents and acts on them, playing the corresponding sounds

Parameters
pointEventCorgiEnginePointsEvent event.

◆ OnMMEvent() [3/3]

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

Catches MMGameEvents and acts on them, playing the corresponding sounds

Parameters
gameEventMMGameEvent event.

◆ Pause()

virtual void MoreMountains.CorgiEngine.GameManager.Pause ( PauseMethods  pauseMethod = PauseMethods.PauseMenu)
virtual

Pauses the game or unpauses it depending on the current state

◆ Reset()

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

this method resets the whole game manager

◆ ResetAllSaves()

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

Deletes all save files

◆ ResetLives()

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

Resets the number of lives to their initial values.

◆ SetActiveInventoryInputManager()

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

◆ SetPersistentCharacter()

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

Sets a new persistent character

Parameters
newCharacter

◆ SetPoints()

virtual void MoreMountains.CorgiEngine.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.CorgiEngine.GameManager.Start ( )
protectedvirtual

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

◆ StorePointsOfEntry()

virtual void MoreMountains.CorgiEngine.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.CorgiEngine.GameManager.StoreSelectedCharacter ( Character  selectedCharacter)
virtual

Stores the selected character for use in upcoming levels

Parameters
selectedCharacterSelected character.

◆ UnPause()

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

Unpauses the game

Member Data Documentation

◆ _initialCurrentLives

int MoreMountains.CorgiEngine.GameManager._initialCurrentLives
protected

◆ _initialMaximumLives

int MoreMountains.CorgiEngine.GameManager._initialMaximumLives
protected

◆ _inventoryInputManager

InventoryInputManager MoreMountains.CorgiEngine.GameManager._inventoryInputManager
protected

◆ _inventoryOpen

bool MoreMountains.CorgiEngine.GameManager._inventoryOpen = false
protected

◆ _pauseMenuOpen

bool MoreMountains.CorgiEngine.GameManager._pauseMenuOpen = false
protected

◆ CurrentLives

int MoreMountains.CorgiEngine.GameManager.CurrentLives = 0

the current number of lives

◆ GameOverScene

string MoreMountains.CorgiEngine.GameManager.GameOverScene

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

◆ MaximumLives

int MoreMountains.CorgiEngine.GameManager.MaximumLives = 0

the maximum amount of lives the character can currently have

◆ ResetLivesOnGameOver

bool MoreMountains.CorgiEngine.GameManager.ResetLivesOnGameOver = true

if this is true, lives will be reset on game over

◆ ResetPersistentCharacterOnGameOver

bool MoreMountains.CorgiEngine.GameManager.ResetPersistentCharacterOnGameOver = true

if this is true, the persistent character will be cleared on game over

◆ ResetStoredCharacterOnGameOver

bool MoreMountains.CorgiEngine.GameManager.ResetStoredCharacterOnGameOver = true

if this is true, the stored character will be cleared on game over

◆ TargetFrameRate

int MoreMountains.CorgiEngine.GameManager.TargetFrameRate =300

the target frame rate for the game

Property Documentation

◆ LevelMapPosition

Vector2 MoreMountains.CorgiEngine.GameManager.LevelMapPosition
getset

the current player

◆ Paused

bool MoreMountains.CorgiEngine.GameManager.Paused
getset

true if the game is currently paused

◆ PersistentCharacter

Character MoreMountains.CorgiEngine.GameManager.PersistentCharacter
getset

the stored selected character

◆ Points

int MoreMountains.CorgiEngine.GameManager.Points
get

the current number of game points

◆ PointsOfEntry

List<PointsOfEntryStorage> MoreMountains.CorgiEngine.GameManager.PointsOfEntry
getset

the list of points of entry and exit

◆ StoredCharacter

Character MoreMountains.CorgiEngine.GameManager.StoredCharacter
getset

the stored selected character

◆ StoredLevelMapPosition

bool MoreMountains.CorgiEngine.GameManager.StoredLevelMapPosition
getset

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