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

The RetroAdventureProgressManager class acts as an example of how you can implement progress in your game. There's no general class for that in the engine, for the simple reason that no two games will want to save the exact same things. But this should show you how it's done, and you can then copy and paste that into your own class (or extend this one, whatever you prefer). More...

Inheritance diagram for MoreMountains.CorgiEngine.RetroAdventureProgressManager:
MoreMountains.Tools.MMSingleton< RetroAdventureProgressManager > MoreMountains.Tools.MMEventListener< CorgiEngineStarEvent > MoreMountains.Tools.MMEventListener< CorgiEngineEvent >

Public Member Functions

virtual void OnMMEvent (CorgiEngineStarEvent corgiStarEvent)
 When we grab a star event, we update our scene status accordingly More...
 
virtual void OnMMEvent (CorgiEngineEvent gameEvent)
 When we grab a level complete event, we update our status, and save our progress to file More...
 
virtual void ResetProgress ()
 A method used to remove all save files associated to progress More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< CorgiEngineStarEvent >
void OnMMEvent (T eventType)
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< CorgiEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

RetroAdventureScene[] Scenes
 the list of scenes that we'll want to consider for our game More...
 
bool CreateSaveGameBtn
 A button to test creating the save file. More...
 

Protected Member Functions

override void Awake ()
 On awake, we load our progress and initialize our stars counter More...
 
virtual void LevelComplete ()
 When a level is completed, we update our progress More...
 
virtual void InitializeStars ()
 Goes through all the scenes in our progress list, and updates the collected stars counter More...
 
virtual void SaveProgress ()
 Saves the progress to a file More...
 
virtual void CreateSaveGame ()
 A test method to create a test save file at any time from the inspector More...
 
virtual void LoadSavedProgress ()
 Loads the saved progress into memory More...
 
virtual void GameOver ()
 This method describes what happens when the player loses all lives. In this case, we reset its progress and all lives will be reset. More...
 
virtual void ResetLives ()
 Resets the number of lives to its initial values More...
 
virtual void OnEnable ()
 OnEnable, we start listening to events. More...
 
virtual void OnDisable ()
 OnDisable, we stop listening to events. More...
 
- Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< RetroAdventureProgressManager >
virtual void InitializeSingleton ()
 Initializes the singleton. More...
 

Static Protected Member Functions

static void InitializeStatics ()
 Statics initialization to support enter play modes More...
 

Static Protected Attributes

const string _saveFolderName = "MMRetroAdventureProgress"
 
const string _saveFileName = "Progress.data"
 
- Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< RetroAdventureProgressManager >
static T _instance
 

Properties

int InitialMaximumLives [get, set]
 
int InitialCurrentLives [get, set]
 
float CurrentStars [get, protected set]
 the current amount of collected stars More...
 
- Properties inherited from MoreMountains.Tools.MMSingleton< RetroAdventureProgressManager >
static T Instance [get]
 Singleton design pattern More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MoreMountains.Tools.MMSingleton< RetroAdventureProgressManager >
static T TryGetInstance ()
 
- Static Public Attributes inherited from MoreMountains.Tools.MMSingleton< RetroAdventureProgressManager >
static bool HasInstance
 
static T Current
 

Detailed Description

The RetroAdventureProgressManager class acts as an example of how you can implement progress in your game. There's no general class for that in the engine, for the simple reason that no two games will want to save the exact same things. But this should show you how it's done, and you can then copy and paste that into your own class (or extend this one, whatever you prefer).

Member Function Documentation

◆ Awake()

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

On awake, we load our progress and initialize our stars counter

Reimplemented from MoreMountains.Tools.MMSingleton< RetroAdventureProgressManager >.

◆ CreateSaveGame()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.CreateSaveGame ( )
protectedvirtual

A test method to create a test save file at any time from the inspector

◆ GameOver()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.GameOver ( )
protectedvirtual

This method describes what happens when the player loses all lives. In this case, we reset its progress and all lives will be reset.

◆ InitializeStars()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.InitializeStars ( )
protectedvirtual

Goes through all the scenes in our progress list, and updates the collected stars counter

◆ InitializeStatics()

static void MoreMountains.CorgiEngine.RetroAdventureProgressManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes

◆ LevelComplete()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.LevelComplete ( )
protectedvirtual

When a level is completed, we update our progress

◆ LoadSavedProgress()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.LoadSavedProgress ( )
protectedvirtual

Loads the saved progress into memory

◆ OnDisable()

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

OnDisable, we stop listening to events.

◆ OnEnable()

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

OnEnable, we start listening to events.

◆ OnMMEvent() [1/2]

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.OnMMEvent ( CorgiEngineEvent  gameEvent)
virtual

When we grab a level complete event, we update our status, and save our progress to file

Parameters
gameEventGame event.

◆ OnMMEvent() [2/2]

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.OnMMEvent ( CorgiEngineStarEvent  corgiStarEvent)
virtual

When we grab a star event, we update our scene status accordingly

Parameters
corgiStarEventCorgi star event.

◆ ResetLives()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.ResetLives ( )
protectedvirtual

Resets the number of lives to its initial values

◆ ResetProgress()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.ResetProgress ( )
virtual

A method used to remove all save files associated to progress

◆ SaveProgress()

virtual void MoreMountains.CorgiEngine.RetroAdventureProgressManager.SaveProgress ( )
protectedvirtual

Saves the progress to a file

Member Data Documentation

◆ _saveFileName

const string MoreMountains.CorgiEngine.RetroAdventureProgressManager._saveFileName = "Progress.data"
staticprotected

◆ _saveFolderName

const string MoreMountains.CorgiEngine.RetroAdventureProgressManager._saveFolderName = "MMRetroAdventureProgress"
staticprotected

◆ CreateSaveGameBtn

bool MoreMountains.CorgiEngine.RetroAdventureProgressManager.CreateSaveGameBtn

A button to test creating the save file.

◆ Scenes

RetroAdventureScene [] MoreMountains.CorgiEngine.RetroAdventureProgressManager.Scenes

the list of scenes that we'll want to consider for our game

Property Documentation

◆ CurrentStars

float MoreMountains.CorgiEngine.RetroAdventureProgressManager.CurrentStars
getprotected set

the current amount of collected stars

◆ InitialCurrentLives

int MoreMountains.CorgiEngine.RetroAdventureProgressManager.InitialCurrentLives
getset

◆ InitialMaximumLives

int MoreMountains.CorgiEngine.RetroAdventureProgressManager.InitialMaximumLives
getset

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