public static void Load() { PlayerData data = PlayerBinary.LoadPlayerData(player); player.name = data.playerName; player.level = data.level; player.currentCheckpoint = GameObject.Find(data.checkpoint).GetComponent <Transform>(); player.currentExp = data.currentExp; player.neededExp = data.neededExp; player.maxExp = data.maxExp; //Arays for (int i = 0; i < player.characterStats.Length; i++) { player.characterStats[i].value = data.stats[i]; } for (int i = 0; i < player.attributes.Length; i++) { player.attributes[i].maxValue = data.maxAttributes[i]; player.attributes[i].currentValue = data.currentAttributes[i]; } //Position 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 static void Load() { //Do this when Binary is done PlayerData data = PlayerBinary.LoadPlayer(); player.name = data.savedName; player.level = data.savedLevel; player.currentCheckpoint = GameObject.Find(data.savedCheckpoint).GetComponent <Transform>(); player.currentExp = data.savedExp; player.neededExp = data.savedNeededExp; player.maxExp = data.savedMaxExp; for (int i = 0; i < player.characterstats.Length; i++) { player.characterstats[i].value = data.stats[i]; } for (int i = 0; i < player.characterstats.Length; i++) { player.characterStatus[i].maxValue = data.maxStatus[i]; player.characterStatus[i].currentValue = data.currentStatus[i]; } player.transform.position = new Vector3(data.savedPlayerPos[0], data.savedPlayerPos[1], data.savedPlayerPos[2]); player.transform.rotation = new Quaternion(data.savedPlayerRot[0], data.savedPlayerRot[1], data.savedPlayerRot[2], data.savedPlayerRot[3]); }
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 static void Load() { //Do this when Binary is done PlayerData data = PlayerBinary.LoadPlayerData(player); player.name = data.playerName; player.level = data.level; player.currentCheckPoint = GameObject.Find(data.checkPoint).GetComponent <Transform>(); player.currentExp = data.currentExp; player.neededExp = data.neededExp; player.maxExp = data.maxExp; for (int i = 0; i < player.characterStats.Length; i++) { player.characterStats[i].value = data.stats[i]; } for (int i = 0; i < player.attributes.Length; i++) { player.attributes[i].maxValue = data.maxAttributes[i]; player.attributes[i].currentValue = data.currentAttributes[i]; } player.transform.position = new Vector3(data.pX, data.pY, data.pZ); player.transform.rotation = new Quaternion(data.rX, data.rY, data.rZ, data.rW); player.playerClass = data.playerClass; player.playerRace = data.playerRace; player.skinTexture = data.skinTexture; player.hairTexture = data.hairTexture; player.eyeTexture = data.eyeTexture; player.mouthTexture = data.mouthTexture; player.clothesTexture = data.clothesTexture; player.armourTexture = data.armourTexture; }
public void LoadPlayer() { //Load Scene SceneManager.LoadScene(2); //Load Player Position and Stats PlayerData data = PlayerBinary.LoadPlayer(); if (data == null) { return; } level = data.savedLevel; characterStatus[0].currentValue = data.savedHealth; name = data.savedName; currentExp = data.savedExp; //Saved Player Position Vector3 position; position.x = data.savedPlayerPos[0]; position.y = data.savedPlayerPos[1]; position.z = data.savedPlayerPos[2]; //Set saved player position as new transform.position = position; Debug.Log("Loaded"); savedPosition = position; }
public void Load() { controller.enabled = false; //do when binary is done PlayerData data = PlayerBinary.LoadPlayerData(player); player.transform.position = new Vector3(data.pX, data.pY, data.pZ); controller.enabled = true; }
private void SaveOnGUI() { if (GUI.Button(new Rect(150, 10, 100, 20), "Save")) { PlayerBinary.SavePlayerData(transform, this); } if (GUI.Button(new Rect(150, 40, 100, 20), "Load")) { PlayerData playerData = PlayerBinary.LoadPlayerData(transform, this); } }
private void OnTriggerStay(Collider other) { //Compare the object other to see if it has tag Checkpoint if (other.gameObject.CompareTag("Checkpoint")) { //Set the current checkpoint to the other transform curCheckPoint = other.transform; //Set the healRate to 10 healRate = 10; //Save the Player data PlayerBinary.SavePlayerData(this); } }
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 Customistaion custom; //Used to access the customisation script public void Save() { //Set the playerSlot on the player Handler to the saveSlot in the PlayerData player.saveSlot = PlayerData.saveSlot; //For all the custom playerStats for (int i = 0; i < custom.playerStats.Length; i++) { //Set the player's Stats name to the name in the custom statName player.stats[i].name = custom.playerStats[i].statName; //Set the player Stats value to be equal to the custom stats stat value plus the custom tempStat player.stats[i].value = custom.playerStats[i].statValue + custom.playerStats[i].tempStat; } //Change the Player's Character Name to be equal to the name on the inputField PlayerName player.characterName = playerName.text; //Set the skin index for the player to the value in the Customistaion scripts skinIndex player.skinIndex = custom.skinIndex; //Set the hair index for the player to the value in the Customistaion scripts hairIndex player.hairIndex = custom.hairIndex; //Set the eyes index for the player to the value in the Customistaion scripts eyesIndex player.eyesIndex = custom.eyesIndex; //Set the mouth index for the player to the value in the Customistaion scripts mouthIndex player.mouthIndex = custom.mouthIndex; //Set the clothes index for the player to the value in the Customistaion scripts clothesIndex player.clothesIndex = custom.clothesIndex; //Set the armour index for the player to the value in the Customistaion scripts armourIndex player.armourIndex = custom.armourIndex; //Set the characterClass for the player to the value in the Customistaion scripts characterClass player.characterClass = custom.charClass; //Set the maxHealth to equal 10 times the Constitution stat player.maxHealth = 10 * player.stats[2].value; //Set the maxMana to equal 10 times the Wisdom stat player.maxMana = 10 * player.stats[3].value; //Set the maxStamina to equal 10 times the Dexterity stat player.maxStamina = 10 * player.stats[1].value; //Access the PlayerBinary script and Save the player data PlayerBinary.SavePlayerData(player); //Change the scene to the main game GameManager.ChangeScene(2); }
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; }
public void Save() { PlayerBinary.SavePlayerData(player); }
public void Save() { //Saves the Player data using the script binary data PlayerBinary.SavePlayerData(player); }
public static void Save() { //Do when Binary is done PlayerBinary.SavePlayer(player); }
public void SavePlayer() { PlayerBinary.SavePlayer(this); }
public void Save() { //do when binary is done PlayerBinary.SavePlayerData(player); }