Esempio n. 1
0
    void LoadTexture()
    {
        string path = Application.persistentDataPath + "/customChar.png";

        //check to see if our save file for this character
        if (File.Exists(path))//if it does have a save file then load and SetTexture Skin, Hair, Mouth and Eyes from PlayerPrefs
        {
            CharDataToSave data = CharCustomSaveData.LoadPlayerData();
            //Textures
            SetTexture("Skin", data.skin);
            skin = data.skin;
            SetTexture("Hair", data.hair);
            hair = data.hair;
            SetTexture("Mouth", data.mouth);
            mouth = data.mouth;
            SetTexture("Eyes", data.eyes);
            eyes = data.eyes;
            SetTexture("Armour", data.armour);
            armour = data.armour;
            SetTexture("Clothes", data.clothes);
            clothes = data.clothes;

            //Stats
            strength     = data.strength;
            dexterity    = data.dexterity;
            constitution = data.constitution;
            wisdom       = data.wisdom;
            intelligence = data.intelligence;
            charisma     = data.charisma;

            //Char Class
            charClass = data.charClass;
            //Char Race
            charRace = data.charRace;
            health   = data.health;
            mana     = data.mana;

            //grab the gameObject in scene that is our character and set its Object name to the Characters name
            characterName = data.characterName; // FOR GUI
            //playerName = data.characterName.ToString; //FOR CANVAS
        }
        else//if it doesnt then load the CustomSet level
        {
            SetTexture("Skin", customSet.skinIndex       = 0);
            SetTexture("Hair", customSet.hairIndex       = 0);
            SetTexture("Mouth", customSet.mouthIndex     = 0);
            SetTexture("Eyes", customSet.eyesIndex       = 0);
            SetTexture("Armour", customSet.armourIndex   = 0);
            SetTexture("Clothes", customSet.clothesIndex = 0);
            //grab the gameObject in scene that is our character and set its Object name to the Characters name
            characterName = customSet.charName; //set name to default
        }
    }
Esempio n. 2
0
 void Save()
 {
     //SetInt for SkinIndex, HairIndex, MouthIndex, EyesIndex,Armour,Clothes
     CharCustomSaveData.SavePlayerData(this);
 }