예제 #1
0
    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();
    }
예제 #2
0
    public void LoadTexture()
    {
        // This function is saying, load all of the pieces and information of the players character
        CustomisationSave data = SaveCustomSet.LoadCustomSet();

        SetTexture("Skin", data.skinIndex);
        SetTexture("Hair", data.hairIndex);
        SetTexture("Mouth", data.mouthIndex);
        SetTexture("Eyes", data.eyesIndex);
        SetTexture("Clothes", data.clothesIndex);
        SetTexture("Armour", data.armourIndex);
        this.gameObject.name = data.characterName;
        CharName.text        = data.characterName;
        CharRace.text        = data.charRace;
        for (int i = 0; i < 6; i++)
        {
            stats[i].text = data.stats[i].ToString();
        }
    }
예제 #3
0
    public static CustomisationSave LoadCustomSet()
    {
        string path = Application.persistentDataPath + "/CustomisationSet";

        if (File.Exists(path))
        {
            BinaryFormatter   formatter  = new BinaryFormatter();
            FileStream        stream     = new FileStream(path, FileMode.Open);
            CustomisationSave customSave = formatter.Deserialize(stream) as CustomisationSave;


            stream.Close();
            return(customSave);
        }
        else
        {
            Debug.Log("Couldn't find file to load");
            return(null);
        }
    }