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 BinaryLoad() { PlayerDataToSave data = PlayerSaveToBinary.LoadData(player); player.maxHealth = data.maxHealth; player.maxMana = data.maxMana; player.maxStamina = data.maxStamina; player.currentHealth = data.currentHealth; player.currentMana = data.currentMana; player.currentStamina = data.currentStamina; player.currentCheckPoint = GameObject.Find(data.checkpoint).GetComponent <Transform>(); if (!(data.currentPositionX == 0 && data.currentPositionY == 0 && data.currentPositionZ == -5)) { player.transform.position = new Vector3(data.currentPositionX, data.currentPositionY, data.currentPositionZ); player.transform.rotation = new Quaternion(data.currentRotationX, data.currentRotationY, data.currentRotationZ, data.currentRotationW); } else { player.transform.position = player.currentCheckPoint.position; player.transform.rotation = player.currentCheckPoint.rotation; Debug.Log("Loading character at " + player.currentCheckPoint.position); } 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 = data.characterClass; player.characterName = data.characterName; 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); }
// Update is called once per frame public void Load() { PlayerDataToSave data = PlayerSaveToBinary.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); }