I have 2 C# scripts, DB and Orbit.
DB contains over 100 classes each with different names, for the purpose of this example we will name the classes Num1,Num2…Num120.
I need to access from the Orbit script one of the classes in DB, let’s say Num50. How would the syntax look for that?
Also the DB script is attached to the Main Camera (if that changes anything).
public class DB : MonoBehaviour
{
void Start ()
{
Element Numfifty = new Element(7,18,118,"Num50","U",294,0,"Unknown","Unknown",2,8,18,32,32,18,8);
}
public class Element
{
public int Perioada;
public int Grupa;
public int NrAt;
public string Nume;
public string Simbol;
public int Masa;
public int Valenta;
public string Tip;
public string Stare;
public int a,b,c,d,e,f,g;
public Element(int tPerioada,int tGrupa,int tNrAt,string tNume,string tSimbol,int tMasa,int tValenta,string tTip,string tStare,int ta,int tb,int tc,int td,int te,int tf,int tg)
{
Perioada=tPerioada;
Grupa=tGrupa;
NrAt=tNrAt;
Simbol=tSimbol;
Masa=tMasa;
Valenta=tValenta;
Tip=tTip;
Stare=tStare;
a=ta;
b=tb;
c=tc;
d=td;
e=te;
f=tf;
g=tg;
}
}
}
Numfifty is just one of the classes declared in the Start function, i just picked one of it that matches the example.
I need to get the elements from Numfifty (the values of “Perioada”,“Grupa” etc) from another script.