//method to set base stats public bool SetBaseStat(PlayerBaseStatsType type, int amount) { if (amount > 0 && availableStatPoints - amount < 0) { return(false); } BaseStats stat = GetBaseStat(type); if (amount < 0 && stat.additionalStat + amount < 0) { return(false); } stat.additionalStat += amount; availableStatPoints -= amount; //call update stats function UpdateStats(); return(true); }
//method to get base stats against type public BaseStats GetBaseStat(PlayerBaseStatsType type) { return(baseStats.Single(stat => stat.statType == type)); }
//method to set stats point allocation by type public void SetStat(PlayerBaseStatsType statType, int value) { statsData.SetBaseStat(statType, value); UpdateStatsVisuals(); }