コード例 #1
0
    /// <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();
    }
コード例 #2
0
 public void ReloadScene()
 {
     if (DebugManager.instance.isManagerDebugMode)
     {
         XDebug.ManagerLog("Reloading Scene: " + SceneManager.GetActiveScene().name);
     }
     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
 }
コード例 #3
0
 public void LoadSceneAsync(string sceneName)
 {
     if (DebugManager.instance.isManagerDebugMode)
     {
         XDebug.ManagerLog("Loading SceneAsync: " + sceneName);
     }
     SceneManager.LoadSceneAsync(sceneName);
 }
コード例 #4
0
 public void LoadSceneAsync(int sceneIndex)
 {
     if (DebugManager.instance.isManagerDebugMode)
     {
         XDebug.ManagerLog("Loading SceneAsync: " + sceneIndex);
     }
     SceneManager.LoadSceneAsync(sceneIndex);
 }
コード例 #5
0
 public void QuitGame()
 {
     if (DebugManager.instance.isManagerDebugMode)
     {
         XDebug.ManagerLog("Quitting Game");
     }
     Application.Quit();
 }
コード例 #6
0
 /// <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;
     }
 }
コード例 #7
0
    /// <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();
    }