Example #1
0
    public void SaveCharacter()
    {
        player.customisationTextureIndex = currentPartsTextureIndex;
        PlayerBinarySave.SavePlayerData(player);


        /*PlayerPrefs.SetInt("Skin Index", currentPartsTextureIndex[0]);
         * PlayerPrefs.SetInt("Hair Index", currentPartsTextureIndex[1]);
         * PlayerPrefs.SetInt("Mouth Index", currentPartsTextureIndex[2]);
         * PlayerPrefs.SetInt("Eyes Index", currentPartsTextureIndex[3]);
         * PlayerPrefs.SetInt("Clothes Index", currentPartsTextureIndex[4]);
         * PlayerPrefs.SetInt("Armour Index", currentPartsTextureIndex[5]);
         *
         * //to do on our own
         * //PlayerPrefs.SetString("Character Name", characterName);
         *
         * //final stat = defaultStat + additionalStat + levelUpStat
         *
         * for (int i = 0; i < player.playerStats.baseStats.Length; i++)
         * {
         *  PlayerPrefs.SetInt(player.playerStats.baseStats[i].baseStatName + " defaultStat", player.playerStats.baseStats[i].defaultStat);
         *  PlayerPrefs.SetInt(player.playerStats.baseStats[i].baseStatName + " additionalStat", player.playerStats.baseStats[i].additionalStat);
         *  PlayerPrefs.SetInt(player.playerStats.baseStats[i].baseStatName + " levelUpStat", player.playerStats.baseStats[i].levelUpStat);
         * }
         *
         * PlayerPrefs.SetString("Character Profession", player.Profession.ProfessionName);*/
    }
Example #2
0
 private void Awake()
 {
     //Load player data
     if (SceneManager.GetActiveScene().name != "Customise")
     {
         PlayerData loadedPlayer = PlayerBinarySave.LoadPlayerData();
         if (loadedPlayer != null)
         {
             playerStats.stats         = loadedPlayer.stats;
             profession                = loadedPlayer.profession;
             customisationTextureIndex = loadedPlayer.customisationTextureIndex;
         }
     }
 }
Example #3
0
    public void Awake()
    {
        //customisation = FindObjectOfType<Customisation>();
        defaultStat = new BaseStats[6]; //player has stats now

        //If not Customisation scene then load player data
        if (SceneManager.GetActiveScene().name != "Customisation")
        {
            //load player data
            PlayerData loadedPlayer = PlayerBinarySave.LoadPlayerData();
            if (loadedPlayer != null)
            {
                stats      = loadedPlayer.playerStats;
                profession = loadedPlayer.profession;
                //customisation.currentPartsTextureIndex = loadedPlayer.customisationTextureIndex;
            }
        }
    }
Example #4
0
 public void Load()
 {
     PlayerData data = PlayerBinarySave.LoadPlayerData();
 }
Example #5
0
 public void Save()
 {
     PlayerBinarySave.SavePlayerData(this);
 }