Hey, I am working on a game, and I need to record some stats of an enemy, so that I can copy them and apply them to another enemy later.
So I call the struct function with this line in script A:
targetStats.getStats();
which uses this code from script B:
public struct statLine
{
public string name;
public int lvl;
public int hp;
public int atk;
public int def;
public int spd;
public int spcl;
}
public statLine getStats()
{
statLine stat = new statLine();
stat.name = myName;
stat.idnum = ID;
stat.lvl = level;
stat.hp = health;
stat.atk = attack;
stat.def = defense;
stat.spd = speed;
stat.spcl = special;
return stat;
}
How can I use this data in script A? I’ve tried making an identical struct and doing this:
recordStats stat = new recordStats();
stat = targetStats.getStats();
public struct statLine
{
public string name;
public int lvl;
public int hp;
public int atk;
public int def;
public int spd;
public int spcl;
}
I’ve tried playing around with passing parameters as well, and I’m out of ideas, short of using a separate function for each stat instead of a struct.
Any suggestions?
Thanks