So I’m making a statistics script for my game and I’m getting an error here is the error
Assets/Scripts/Character Classes/ModifiedStat.cs(21,66): error CS1061: Type Attribute’ does not contain a definition forAdjustedValue’ and no extension method AdjustedValue’ of typeAttribute’ could be found (are you missing a using directive or an assembly reference?)
And then I’m using 3 scripts so here’s all of them
public class BaseStat {
private int _baseValue; //the base value of this stat
private int _buffValue; //the amount of the buff to this stat
private int _expToLevel; //the total amount of exp needed to raise this skill
private float _levelModifier; //the modifier applied to the exp needed to raise the skill
public BaseStat() {
_baseValue = 0;
_buffValue = 0;
_levelModifier = 1.1f;
_expToLevel = 100;
}
#region Basic Setters and Getters
//Basic Setters and Getters
public int BaseValue {
get{ return _baseValue; }
set{ _baseValue = value; }
}
public int BuffValue {
get { return _buffValue; }
set { _buffValue = value; }
}
public int ExpToLevel {
get{ return _expToLevel; }
set{ _expToLevel = value; }
}
public float LevelModifier {
get{ return _levelModifier; }
set{ _levelModifier = value; }
}
#endregion
private int CalculateExpToLevel() {
return (int)(_expToLevel * _levelModifier);
}
public void LevelUp() {
_expToLevel = CalculateExpToLevel();
_baseValue++;
}
public int AdjustedBaseValue() {
return _baseValue + _buffValue;
}
}
using System.Collections.Generic;
public class ModifiedStat : BaseStat {
private List<ModifyingAttribute> _mods; //A list of Attributes that modify this stat
private int _modValue; //The amount added to the baseValue from the modifiers
public ModifiedStat() {
_mods = new List<ModifyingAttribute>();
_modValue = 0;
}
public void AddModifier( ModifyingAttribute mod) {
_mods.Add(mod);
}
private void CalculateModValue() {
_modValue = 0;
if(_mods.Count > 0)
foreach(ModifyingAttribute att in _mods)
_modValue += (int)(att.attribute.AdjustedValue * att.ratio);
}
public new int AdjustedBaseValue {
get{ return BaseValue + BuffValue + _modValue; }
}
public void Update() {
CalculateModValue();
}
}
public struct ModifyingAttribute {
public Attribute attribute;
public float ratio;
}
public class Attribute : BaseStat {
public Attribute() {
ExpToLevel = 50;
LevelModifier = 1.05f;
}
}
public enum AttributeName {
Strength,
Dexterity,
Agility,
Speed,
Concentration,
Willpower,
Charisma
}
The one I get the errors in is the ModifiedStat Script (Second one) but they all intertwine with each other (mainly BaseStat) so if anyone could help that would be greatly appreciated!