public void RefreshStatsBasedOnLevel() { foreach (KeyValuePair <ModifiableStat, PlayerStatWithModifiers> statPair in this.modifiableStats) { PlayerStatWithModifiers statWithModifiers = statPair.Value; statWithModifiers.ApplyBaseValueBasedOnLevel(this.level); } }
// Level up stat. Used for hero. public bool LevelUpStat(ModifiableStat stat) { // TODO: FIX THIS if (!this.modifiableStats.ContainsKey(stat)) { Debug.LogError("ERROR: Not assignable stat"); return(false); } PlayerStatWithModifiers theStat = this.modifiableStats[stat]; int costToLevelUp = StatLevelHelpers.GetCostToLevelUpStat(theStat.growth, theStat.divisor); theStat.growth += StatLevelHelpers.LEVEL_UP_GROWTH_INCREASE; theStat.ApplyBaseValueBasedOnLevel(this.level); this.statPoints -= costToLevelUp; return(true); }