I'm wondering how I could get a String Variable (CurrentWeapon), to work like a Class reference (not sure how I can explain, as I am quite the noob, as you probably understand) to get different class variables from different classes depending on what weapon I have selected. The following script is a class where I have stored all the properties and stats for a weapon.
public class Stats_SMG : MonoBehaviour {
public static string Name = "SMG";
public static int Damage = 20;
public static float FireRate = 0.3f;
public static int Magazine = 25;
public static int ReserveMagazines = 2;
}
The following script is how I try to "dynamically" access my weapons stat-classes (assume that I have multiple of the scripts above with different names and properties to differnet weapons, etc)
public class Shooting : MonoBehaviour {
Stats_SMG smg;
Stats_AssaultRifle ar;
public string CurrentWeapon;
void Start() {
CurrentWeapon = smg;
Debug.Log (CurrentWeapon.Damage);
}
The above is just a quick sample of what I have to (hopefully) explain to you the problem that I have. Sorry if any sentences or words are misspelled or weird, as English is not my first language.