public CharacterData CreateCharData(int attackPower, int healthPower) { CharacterData character = new CharacterData(); character.Initialize(); character.id = (playerProfile.lastId + 1); character.attackPower = attackPower; character.healPower = healthPower; character.experience = 0; character.level = 1; character.attackPower = Formula.CalculateAttackPower(character.level, character.type); character.health = 10000; // Will be lowered by MaxHealth Check try { while (IsDuplicateName(character.name)) { character.GenerateName(); } } catch {} try { character.currentHat = UnityEngine.Random.Range(0, playerProfile.Hats.Length); character.currentWeapon = UnityEngine.Random.Range(0, playerProfile.Weapons.Length); character.currentArmour = UnityEngine.Random.Range(0, playerProfile.Armour.Length); } catch {} character.originalName = character.name; return(character); }
void UpdateStatsPanel() { transform.Find("StatsPanel").transform.Find("Name").transform.Find("Text").GetComponent <Text>().text = currentChar.name; transform.Find("StatsPanel").transform.Find("Name").GetComponent <Button>().interactable = ((currentChar.originalName != "Steve") && (currentChar.originalName != "Daryl") && (currentChar.originalName != "Dillon")); transform.Find("StatsPanel").transform.Find("ATK").GetComponent <Text>().text = "ATK: " + ( Formula.CalculateAttackPower(currentChar.level, currentChar.type) + GetAddedAttack()) + " (" + Formula.CalculateAttackPower(currentChar.level, currentChar.type) + GetAddedAttack().ToString("+#;-#;+0") + ")"; transform.Find("StatsPanel").transform.Find("HLTH").GetComponent <Text>().text = "HLTH: " + ( Formula.CalculateMaxHealth(currentChar.level, currentChar.type) + GetAddedDefense()) + " (" + Formula.CalculateMaxHealth(currentChar.level, currentChar.type) + GetAddedDefense().ToString("+#;-#;+0") + ")"; transform.Find("StatsPanel").transform.Find("Class").GetComponent <Text>().text = "Class: " + currentChar.type.ToString(); transform.Find("StatsPanel").transform.Find("Skill").GetComponent <Text>().text = "Skill: " + currentChar.abilityToUse.ToString(); }
private void UpdateStats() { charData.attackPower = Formula.CalculateAttackPower(charData.level, charData.type) + charData.addedAttack; charData.healPower = Formula.CalculateHealPower(charData.level, charData.type); }