Hey friendos, newbie question here;
I’m currently using a list to store data for each weapon the player can use, but iI don’t know how to reference it efficiently. my current setup is;
[System.Serializable]
public class Weaponz{ //creates list with data of every weapon
public string name;
public float placeholderStat1, placeholderStat2;
}
[ExecuteInEditMode]
public class Test : MonoBehaviour
{
public List<Weaponz> weapons_Info;
public Weaponz pistol = new Weaponz(), shotgun = new Weaponz();
public float activeweapon;
public float currentPlaceholderStat1, currentPlaceholderStat2; //active memory of weapon
void Start() //change weapon stats
{
if(activeweapon == 1){
currentPlaceholderStat1 = pistol.placeholderStat1;
currentPlaceholderStat2 = pistol.placeholderStat2;
}
if(activeweapon == 2){
currentPlaceholderStat1 = shotgun.placeholderStat1;
currentPlaceholderStat2 = pistol.placeholderStat2;
}
}
}
basically I want to be able to pull variables in one function, if that makes sense?
thanks!