public PlayerData(CustomisationSet set)
    {
        skin    = set.skin;
        hair    = set.hair;
        mouth   = set.mouth;
        eyes    = set.eyes;
        armour  = set.armour;
        clothes = set.clothes;

        skinIndex    = set.skinIndex;
        hairIndex    = set.hairIndex;
        mouthIndex   = set.mouthIndex;
        eyeIndex     = set.eyeIndex;
        armourIndex  = set.armourIndex;
        clothesIndex = set.clothesIndex;

        charName = set.charName;

        stats    = new int[6];
        stats[0] = set.stats[0] + set.tempStats[0];
        stats[1] = set.stats[1] + set.tempStats[1];
        stats[2] = set.stats[2] + set.tempStats[2];
        stats[3] = set.stats[3] + set.tempStats[3];
        stats[4] = set.stats[4] + set.tempStats[4];
        stats[5] = set.stats[5] + set.tempStats[5];

        CharacterClass characterClass = set.characterClass;
    }
Example #2
0
 public CharDataToSave(CustomisationSet custom)
 {
     //Textures
     skin    = custom.skinIndex;
     hair    = custom.hairIndex;
     mouth   = custom.mouthIndex;
     eyes    = custom.eyesIndex;
     armour  = custom.armourIndex;
     clothes = custom.clothesIndex;
     //Stats
     strength     = custom.stats[0] + custom.tempStats[0];
     dexterity    = custom.stats[1] + custom.tempStats[1];
     constitution = custom.stats[2] + custom.tempStats[2];
     wisdom       = custom.stats[3] + custom.tempStats[3];
     intelligence = custom.stats[4] + custom.tempStats[4];
     charisma     = custom.stats[5] + custom.tempStats[5];
     //Char Class
     charClass = custom.className.text;
     //Char Race
     charRace = custom.raceName.text;
     health   = custom.health;
     mana     = custom.mana;
     //charRace = custom
     //characterName = custom.charName; //FOR GUI
     characterName = custom.charName; //FOR CANVAS
 }
    public static void CustomisationSet(CustomisationSet player)
    {
        BinaryFormatter   formatter  = new BinaryFormatter();
        string            path       = Application.persistentDataPath + "/CustomisationSet";
        FileStream        stream     = new FileStream(path, FileMode.Create);
        CustomisationSave customSave = new CustomisationSave(player);

        formatter.Serialize(stream, customSave);
        stream.Close();
    }
    public SavedData(CustomisationSet custom)
    {
        skin    = custom.skinIndex;
        hair    = custom.hairIndex;
        mouth   = custom.mouthIndex;
        eyes    = custom.eyesIndex;
        armour  = custom.armourIndex;
        clothes = custom.clothesIndex;

        charName = custom.characterName;
    }
Example #5
0
    public static void SavePlayer(CustomisationSet set)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player.sav";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(set);

        formatter.Serialize(stream, data);
        stream.Close();
    }
 public PlayerData(CustomisationSet customisationset)
 {
     skin          = customisationset.skinIndex;
     hair          = customisationset.hairIndex;
     mouth         = customisationset.mouthIndex;
     eyes          = customisationset.eyesIndex;
     armour        = customisationset.armourIndex;
     clothes       = customisationset.clothesIndex;
     charName      = customisationset.charName;
     statArray     = customisationset.statArray;
     selectedClass = customisationset.selectedClass;
 }
Example #7
0
    public int[] stats = new int[6];                                        // Array containing 6 player stats


    public CustomisationSave(CustomisationSet player)
    {
        skinIndex     = player.skinIndex; // Things to save, all meshes the player has selected to use on their character
        hairIndex     = player.hairIndex;
        eyesIndex     = player.eyesIndex;
        mouthIndex    = player.mouthIndex;
        clothesIndex  = player.clothesIndex;
        armourIndex   = player.armourIndex;
        characterName = player.characterName;        // The players name
        charClass     = player.charClass.ToString(); // The players class
        charRace      = player.charRace.ToString();  // The players race
        for (int i = 0; i < 6; i++)
        {
            stats[i] = (player.stats[i] + player.tempStats[i]); // a loop to cycle through all of the stats asscioated with each class that the player selects
        }
    }
    public CustomisationSave(CustomisationSet player)
    {
        skinIndex    = player.skinIndex;
        charClass    = player.charClass.ToString();
        charRace     = player.charRace.ToString();
        hairIndex    = player.hairIndex;
        eyesIndex    = player.eyesIndex;
        mouthIndex   = player.mouthIndex;
        clothesIndex = player.clothesIndex;
        armourIndex  = player.armourIndex;

        for (int i = 0; i < 6; i++)
        {
            stats[i] = (player.stats[i] + player.tempStats[i]);
        }
    }
Example #9
0
    public static void SaveData(CustomisationSet customisationset)
    {
        // Binary Formatter
        BinaryFormatter formatter = new BinaryFormatter();
        // Save Path
        // string path = Application.persistentDataPath + "/" + player.name + ".format";
        string path = Application.persistentDataPath + "/TheCakeIsALie.format";
        // File Stream
        FileStream stream = new FileStream(path, FileMode.Create);
        // Data
        PlayerData playerdata = new PlayerData(customisationset);

        // Converts to Binary and dave the path
        formatter.Serialize(stream, playerdata);
        // End
        stream.Close();
    }
Example #10
0
    public static void SavePlayerCustomisation(CustomisationSet custom)
    {
        // reference to binary formatter (this changing the code into binary language)
        BinaryFormatter formatter = new BinaryFormatter();

        // path to save to "/save.rar" file
        string path = Application.persistentDataPath + "/Save.png";

        // file stream create file at path
        FileStream stream = new FileStream(path, FileMode.Create);

        // dataToSave with player info
        SavedData data = new SavedData(custom);

        // format and serialize location and data
        formatter.Serialize(stream, data);

        // end
        stream.Close();
    }
Example #11
0
    public static void SavePlayerData(CustomisationSet customSet)
    {
        //reference to binary formatter
        BinaryFormatter formatter = new BinaryFormatter();

        //path to save to
        string path = Application.persistentDataPath + "/customChar.png";

        //file stream create file at path
        FileStream stream = new FileStream(path, FileMode.Create);

        //dataToSave with player info
        CharDataToSave data = new CharDataToSave(customSet);

        //format and serialize location and data
        formatter.Serialize(stream, data);

        //end
        stream.Close();
        Debug.Log("Saved");
    }
Example #12
0
 public CustomData(CustomisationSet texture)
 {
 }
Example #13
0
 private void Awake()
 {
     instance = this;
     // Here, the key bindings are set to what is stored in the save file. If it is unable to find the stored (KeyCode), then the named input is set to a defined default KeyCode.
     fullPath = Application.dataPath + "/SaveData/Data/" + fileName + ".xml";
 }