public void SetClass(GameCode.ClassName _name) { m_className = _name; int classIndex = (int)m_className; for (int i = 0; i < 6; i++) { SetAtttributeValue((GameCode.BasicAttributeName)i, GameCode.InitBasicAttributes[classIndex, i]); } hasLearned = new bool[GameCode.skillsAllClasses[classIndex].Count]; if (classIndex == 0) { atkRange = 3; } else if (classIndex == 1) { atkRange = 8; } else if (classIndex == 2) { atkRange = 10; } else { atkRange = 2; } }
void Awake( ) { charMng = this; Application.targetFrameRate = targetFrameRate; PlayerData.GetInstance().LoadAll(); PlayerData.GetInstance().canMove = true; GameCode.ClassName className = PlayerData.GetInstance().GetClassName(); player = (GameObject)PoolManager.GetInstance().GetPool(playerPrefabs[(int)className]).GetObject(playerOriginPosition); SkillManager skillMng = player.GetComponent <SkillManager>(); for (int i = 0; i < PlayerData.GetInstance().hasLearned.Length; i++) { if (PlayerData.GetInstance().hasLearned[i]) { skillMng.Learn(i); } } }
// load all members from hard disk public void LoadAll( ) { gold = PlayerPrefs.GetInt("gold"); m_playerName = PlayerPrefs.GetString("player name"); m_className = (GameCode.ClassName)PlayerPrefs.GetInt("class index"); m_birthName = (GameCode.BirthAndGiftName)PlayerPrefs.GetInt("birth index"); m_pointsToSpend = PlayerPrefs.GetInt("points to spend"); exp = PlayerPrefs.GetInt("exp"); level = PlayerPrefs.GetInt("level"); armPieRate = PlayerPrefs.GetFloat("armour piercing"); for (int i = 0; i < 6; i++) { m_basicAttributes[i] = PlayerPrefs.GetInt(((GameCode.BasicAttributeName)i).ToString()); } int classIndex = (int)m_className; hasLearned = new bool[GameCode.skillsAllClasses[classIndex].Count]; for (int i = 0; i < hasLearned.Length; i++) { hasLearned[i] = PlayerPrefs.GetInt(GameCode.skillsAllClasses[classIndex][i].ToString()) == 1; } #region general attributes curLife = PlayerPrefs.GetFloat("curLife"); maxLife = PlayerPrefs.GetFloat("maxLife"); curMana = PlayerPrefs.GetFloat("curMana"); maxMana = PlayerPrefs.GetFloat("maxMana"); atk = PlayerPrefs.GetFloat("atk"); maxAtk = PlayerPrefs.GetFloat("maxAtk"); def = PlayerPrefs.GetFloat("def"); maxDef = PlayerPrefs.GetFloat("maxDef"); crit = PlayerPrefs.GetFloat("crit"); critRate = PlayerPrefs.GetFloat("critRate"); hitRate = PlayerPrefs.GetFloat("hitRate"); atkSpeed = PlayerPrefs.GetFloat("atkSpeed"); moveSpeed = PlayerPrefs.GetFloat("moveSpeed"); healingRate = PlayerPrefs.GetFloat("healingRate"); manaingRate = PlayerPrefs.GetFloat("manaingRate"); dodgeRate = PlayerPrefs.GetFloat("dodgeRate"); #endregion }
public void SetClass(GameCode.ClassName _name) { m_className = _name; int classIndex = (int)m_className; for (int i = 0; i < 6; i++) { SetAtttributeValue((GameCode.BasicAttributeName)i, GameCode.InitBasicAttributes[classIndex, i]); } hasLearned = new bool[GameCode.skillsAllClasses[classIndex].Count]; if (classIndex == 0) atkRange = 3; else if (classIndex == 1) atkRange = 8; else if (classIndex == 2) atkRange = 10; else atkRange = 2; }