public void Load() { PlayerData data = PlayerBinary.LoadData(player); player.name = database.charName; player.skinIndex = database.skinIndex; player.hairIndex = database.hairIndex; player.mouthIndex = database.mouthIndex; player.eyesIndex = database.eyesIndex; player.clothesIndex = database.clothesIndex; player.armourIndex = database.armourIndex; player.characterClass = (CharacterClass)database.classEnumIndex; player.characterName = database.charName; player.stats[0].value = database.strengthIndex; player.stats[1].value = database.dexterityIndex; player.stats[2].value = database.constitutionIndex; player.stats[3].value = database.wisdomIndex; player.stats[4].value = database.intelligenceIndex; player.stats[5].value = database.charismaIndex; Debug.Log("Loading stuffs"); LoadCustomisation.SetTexture("Skin", database.skinIndex); LoadCustomisation.SetTexture("Hair", database.hairIndex); LoadCustomisation.SetTexture("Mouth", database.mouthIndex); LoadCustomisation.SetTexture("Eyes", database.eyesIndex); LoadCustomisation.SetTexture("Clothes", database.clothesIndex); LoadCustomisation.SetTexture("Armour", database.armourIndex); }
public void Load() { //Load data into a new PlayerData PlayerData data = PlayerBinary.LoadData(); //Set the player character name to the name in player data player.characterName = data.playerName; //Set the max health to the max health in data player.maxHealth = data.maxHealth; //Set the max mana to the max mana in data player.maxMana = data.maxMana; //Set the max stamina to the max stamina in data player.maxStamina = data.maxStamina; //Set the current health to the current healh in data player.curHealth = data.curHealth; //Set the current mana to the current mana in data player.curMana = data.curMana; //Set the current stamina ot the currrent stamina in data player.curStamina = data.curStamina; //Set the character controller to false player.GetComponent <CharacterController>().enabled = false; //Change the position of the player using the values in data player.transform.position = new Vector3(data.pX, data.pY, data.pZ); //Set the character controller to true player.GetComponent <CharacterController>().enabled = true; //Set the roation of the player to the values in data player.transform.rotation = new Quaternion(data.rX, data.rY, data.rZ, data.rW); //Set the skin index to the index in data player.skinIndex = data.skinIndex; //Set the eye index to the index in data player.eyesIndex = data.eyesIndex; //Set the mouth index to the index in data player.mouthIndex = data.mouthIndex; //Set the hair index to the index in data player.hairIndex = data.hairIndex; //Set the clothes index to the index in data player.clothesIndex = data.clothesIndex; //Set the armour index to the index in data player.armourIndex = data.armourIndex; //for all stats for (int i = 0; i < data.stats.Length; i++) { //Set the stat value to the value in data player.stats[i].value = data.stats[i]; } }
public void Load() { PlayerData data = PlayerBinary.LoadData(player); player.name = data.playerName; player.curCheckPoint = GameObject.Find(data.checkPoint).GetComponent <Transform>(); player.maxHealth = data.maxHealth; player.maxMana = data.maxMana; player.maxStamina = data.maxStamina; player.curHealth = data.curHealth; player.curMana = data.curMana; player.curStamina = data.curStamina; player.transform.position = new Vector3(data.pX, data.pY, data.pZ); player.transform.rotation = new Quaternion(data.rX, data.rY, data.rZ, data.rW); }
public void Load() { PlayerData data = PlayerBinary.LoadData(player); player.name = data.playerName; player.curCheckPoint = GameObject.Find(data.checkPoint).GetComponent <Transform>(); player.maxHealth = data.maxHealth; player.maxMana = data.maxMana; player.maxStamina = data.maxStamina; player.curHealth = data.curHealth; player.curMana = data.curMana; player.curStamina = data.curStamina; if (!(data.pX == 0 && data.pY == 0 && data.pZ == 0)) { player.transform.position = new Vector3(data.pX, data.pY, data.pZ); player.transform.rotation = new Quaternion(data.rX, data.rY, data.rZ, data.rW); } else { player.transform.position = player.curCheckPoint.position; player.transform.rotation = player.curCheckPoint.rotation; } player.skinIndex = data.skinIndex; player.hairIndex = data.hairIndex; player.mouthIndex = data.mouthIndex; player.eyesIndex = data.eyesIndex; player.clothesIndex = data.clothesIndex; player.armourIndex = data.armourIndex; player.characterClass = (CharacterClass)data.classIndex; player.characterName = data.playerName; for (int i = 0; i < player.stats.Length; i++) { player.stats[i].value = data.stats[i]; } LoadCustomisation.SetTexture("Skin", data.skinIndex); LoadCustomisation.SetTexture("Hair", data.hairIndex); LoadCustomisation.SetTexture("Mouth", data.mouthIndex); LoadCustomisation.SetTexture("Eyes", data.eyesIndex); LoadCustomisation.SetTexture("Clothes", data.clothesIndex); LoadCustomisation.SetTexture("Armour", data.armourIndex); }
public LoadData[] data; //stuct LoadData data // Start is called before the first frame update void Start() { PlayerPrefs.DeleteAll(); //Delete All PlayerPrefs //For 3 save slots for (int i = 1; i < 4; i++) { //Set the PlayerData saveslot int to i PlayerData.saveSlot = i; //Set the datas blank state to true data[i].blank = true; //Load the player data into the variable player PlayerData player = PlayerBinary.LoadData(); //If player doesnt equal null if (player != null) { //Set blank to false data[i].blank = false; //Set the name to the players name on the save file data[i].name = player.playerName; //Change the checkpoint to the checkpoint on the save file data[i].checkpoint = player.checkPoint; //Change the health to the health on the player save file data[i].health = player.curHealth; } else { //Set blank to true data[i].blank = true; //Change the name to blank data[i].name = "Blank"; //Change the checkpoint to be beach data[i].checkpoint = "Beach"; //Change the health to be 100 data[i].health = 100f; } //Change the display name to be the name in data data[i].desName.text = data[i].name; //Change the display checkpoint to be the checkpoint in data data[i].desCheckpoint.text = data[i].checkpoint; //Change the display health to the health in data data[i].desHealth.text = data[i].health.ToString(); } }
public void Load() { PlayerData data = PlayerBinary.LoadData(); //player.name = data.playerName; player.maxHealth = data.maxHealth; player.maxMana = data.maxMana; player.maxStamina = data.maxStamina; player.curHealth = data.curHealth; player.curMana = data.curMana; player.curStamina = data.curStamina; player.transform.position = new Vector3(data.pX, data.pY, data.pZ); player.transform.rotation = new Quaternion(data.rX, data.rY, data.rZ, data.rW /*, data.rW*/); player.skinIndex = data.skinIndex; player.eyesIndex = data.eyesIndex; player.mouthIndex = data.mouthIndex; player.hairIndex = data.hairIndex; player.clothesIndex = data.clothesIndex; player.armourIndex = data.armourIndex; }