The probable reason for me not being able to find the answer when searching is my lack of knowledge when it comes to coding terms and expressions.
public Vital Strength;
Declaring a Vital called Strength.
All good so far.
Strength = new Vital(5, "Strength");
Here I am creating the Strength vital by calling upon the function Vital,
passing the integer 5, and the string “Strenght” as arguments.
public Vital(int _valueMod, string _statName)
{
currentValue = Player.current._statName.currentValue * _valueMod;
maxValue = Player.current._statName.currentValue * _valueMod;
}
Here is where it (obviously) does not work. My Player class has no declaration for
_vitalName(because it wouldn’t do anything, I can’t grab the currentValue out from a string).
I want to grab a currentValue from a Stat, using not the direct reference to the Stat(as this would not make it useable for more than 1 stat as I would have to manually type the name of a Vital) but a reference that can be changed in the Call arguments.
Is this possible?