public void GainExp(int amount) { currentExp += amount; //check for levelup if (currentExp >= levelUp) { currentExp = currentExp - levelUp; //can trigger level up events here level += 1; levelUp = (int)(levelUp * levelUpScaling); bulletDamage = (int)(bulletDamage * damageScaling); statLogic.UpdateDamage(bulletDamage); if (level % bulletUpgrade == 0) { bulletCount += 1; statLogic.UpdateBulletCount(bulletCount); } expBar.maxValue = levelUp; levelUI.text = level.ToString(); eventScript.TriggerLevelUp(); //upgrade player health and refresh hp PlayerHealth hp = GetComponent <PlayerHealth>(); hp.LevelUp((int)(hp.startingHealth * healthScaling)); } expBar.value = currentExp; }
// Start is called before the first frame update void Start() { currentExp = 0; expBar.maxValue = levelUp; expBar.value = currentExp; eventScript = eventDisplay.GetComponent <EventScript>(); statLogic = statDisplay.GetComponent <StatLogic>(); statLogic.UpdateDamage(bulletDamage); statLogic.UpdateBulletCount(bulletCount); }