/// <summary> /// Initialize/Load the XP Manager /// </summary> public void InitXPManager() { //Check to See if we have not initialized the XP Manager if (PlayerPrefs.GetInt("isXPManagerInit", 0) == 0) { if (DebugManager.instance.isManagerDebugMode) { XDebug.ManagerLog("XP MANAGER NOT INITIALIZED, INITIALIZING"); } //Save current XPManager Values SaveXPManager(); PlayerPrefs.SetInt("isXPManagerInit", 1); } else { if (DebugManager.instance.isManagerDebugMode) { XDebug.ManagerLog("XP MANAGER INITIALIZED, LOADING VALUES"); } MaxLevelCap = PlayerPrefs.GetInt("XPManager_MaxLevelCap"); CurrentLevel = PlayerPrefs.GetInt("XPManager_CurrentLevel"); CurrentXP = PlayerPrefs.GetInt("XPManager_CurrentXP"); LevelUpXP = PlayerPrefs.GetInt("XPManager_LevelUpXP"); } PlayerPrefs.Save(); }
public void ReloadScene() { if (DebugManager.instance.isManagerDebugMode) { XDebug.ManagerLog("Reloading Scene: " + SceneManager.GetActiveScene().name); } SceneManager.LoadScene(SceneManager.GetActiveScene().name); }
public void LoadSceneAsync(string sceneName) { if (DebugManager.instance.isManagerDebugMode) { XDebug.ManagerLog("Loading SceneAsync: " + sceneName); } SceneManager.LoadSceneAsync(sceneName); }
public void LoadSceneAsync(int sceneIndex) { if (DebugManager.instance.isManagerDebugMode) { XDebug.ManagerLog("Loading SceneAsync: " + sceneIndex); } SceneManager.LoadSceneAsync(sceneIndex); }
public void QuitGame() { if (DebugManager.instance.isManagerDebugMode) { XDebug.ManagerLog("Quitting Game"); } Application.Quit(); }
/// <summary> /// Set the Current Player Level to Specified LevelNumber /// </summary> /// <param name="levelNumber">The LevelNumber to Set Player</param> public void SetLevel(int levelNumber) { CurrentLevel = levelNumber; CurrentXP = 0; if (levelNumber > MaxLevelCap) { XDebug.ManagerLog("Setting Level Above then Max Level Cap, Setting to MaxLevel", "***[MAX LEVEL CAP ERROR]***"); CurrentLevel = MaxLevelCap; } }
/// <summary> /// Resets the XP Manager to Defaults /// </summary> public void ResetXPManager() { XDebug.ManagerLog("Resetting XP Manager, If the Reset is not as per requirement change the base code here", "**** RESETTING XP MANAGER ****"); MaxLevelCap = 100; CurrentLevel = 1; CurrentXP = 0; LevelUpXP = 1000; SaveXPManager(); }