void SetStats() { switch (Progression.playerClass) { case 1: BaseStat.BaseValue = 10; BaseStat.BuffValue = 5; jScript.startATK = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.90f); jScript.startINT = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 0.25f); jScript.startAGI = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 0.55f); break; case 2: BaseStat.BaseValue = 10; BaseStat.BuffValue = 4; jScript.startATK = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.70f); jScript.startINT = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 1.25f); jScript.startAGI = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 0.45f); break; case 3: BaseStat.BaseValue = 10; BaseStat.BuffValue = 4; jScript.startATK = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.80f); jScript.startINT = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 0.5f); jScript.startAGI = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 2.0f); break; case 4: BaseStat.BaseValue = 10; BaseStat.BuffValue = 4; jScript.startATK = (int)(_player.GetPrimaryAttribute(0).AdjustedBaseValue * 0.85f); jScript.startINT = (int)(_player.GetPrimaryAttribute(1).AdjustedBaseValue * 0.5f); jScript.startAGI = (int)(_player.GetPrimaryAttribute(2).AdjustedBaseValue * 1.45f); break; } if (!PlayerPrefs.HasKey("Player level")) { jScript.currentLV = _player.Level; jScript.currentEXP = _player.Exp; jScript.currentNEXT = _player.ExpToLvl; jScript.startLCK = (int)(_player.GetPrimaryAttribute(3).AdjustedBaseValue * 0.1f); jScript.fullHP = (_player.GetVital(0).AdjustedBaseValue *jScript.startATK) + jScript.fullHP; jScript.currentHP = jScript.fullHP; jScript.fullMP = (_player.GetVital(1).AdjustedBaseValue *jScript.startINT) + jScript.fullMP; jScript.currentMP = jScript.fullMP; } }
// // Use this for initialization // void Start () { // // // } // // // Update is called once per frame // void Update () { // // } public void SaveCharData() { //PlayerPrefs.DeleteAll(); //Uncomment this and run the game every time you make changes to what is saved then comment back. <- precautionary device PlayerPrefs.SetString("currentLvl", Application.loadedLevelName); pc = GameObject.Find("Player"); BaseCharacter pcClass = pc.GetComponent <BaseCharacter>(); print(PlayerPrefs.GetString("currentLvl")); for (int cnt = 0; cnt < Enum.GetValues(typeof(AttributeName)).Length; cnt++) { PlayerPrefs.SetInt(((AttributeName)cnt).ToString(), pcClass.GetPrimaryAttribute(cnt).BaseValue); } for (int cnt = 0; cnt < Enum.GetValues(typeof(VitalName)).Length; cnt++) { PlayerPrefs.SetInt(((VitalName)cnt).ToString(), pcClass.GetVital(cnt).BaseValue); PlayerPrefs.SetInt(((VitalName)cnt).ToString(), pcClass.GetVital(cnt).CurValue); } SavePlayerPosition(pc); PlayerPrefs.Save(); }