private void SetExperienceBar() { float xp = experience.GetExperiencePoints() - baseStats.GetPointsForCurrentLevel(); if (xp < 0) { xp = experience.GetExperiencePoints(); } float xpNeeded = baseStats.GetPointsForNextLevel() - baseStats.GetPointsForCurrentLevel(); Vector3 newScale = new Vector3(xp / xpNeeded, 1, 1); foreground.localScale = newScale; }
private int CalculateLevel() { if (experience == null) { return(startingLevel); } float currentXP = experience.GetExperiencePoints(); int maxLevel = progression.GetMaxLevel(Stat.ExperienceToLevelUp, characterClass); for (int level = 1; level <= maxLevel; level++) { if (currentXP < progression.GetStat(Stat.ExperienceToLevelUp, characterClass, level)) { return(level); } } return(maxLevel); }
public int CalculateLevel() { if (experience == null) { return(startLevel); } float currentExperience = experience.GetExperiencePoints(); int currentLevel = 1; int maxLevel = progression.GetLevels(Stat.ExperienceToLevelUp, characterClass); for (int i = 0; i < maxLevel; i++) { float experienceNeedToLevelUp = progression.GetStat(Stat.ExperienceToLevelUp, characterClass, currentLevel); if (currentExperience >= experienceNeedToLevelUp) { currentLevel++; } } return(currentLevel); }
private void Update() { GetComponent <Text>().text = String.Format("{0}", experience.GetExperiencePoints()); }
void Update() { experienceText.text = "XP: " + experience.GetExperiencePoints().ToString(); }