コード例 #1
0
ファイル: PlayerStats.cs プロジェクト: BenjixD/ProjectMooks
 public void RefreshStatsBasedOnLevel()
 {
     foreach (KeyValuePair <ModifiableStat, PlayerStatWithModifiers> statPair in this.modifiableStats)
     {
         PlayerStatWithModifiers statWithModifiers = statPair.Value;
         statWithModifiers.ApplyBaseValueBasedOnLevel(this.level);
     }
 }
コード例 #2
0
ファイル: PlayerStats.cs プロジェクト: BenjixD/ProjectMooks
    // 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);
    }