I am coming back again into hobby game development after about 6 months away. I'm just trying to learn some kind of basic things again. I'm at the very start of making a very simple boxing management simulator. Later, I will be trying to re-learn using databases and might ask for more help.
But for now, I'm making a Boxer class which will hold all the data on each boxer (eg. Name, height, number of wins, punch power etc etc). I've used private variables for those and then have made my own methods for each variable called Getxyz().
I have seen people doing things like 'public int xyz { Get(); }' but i dont understand how that would work.
Is the way I'm doing ok (it does seem long-winded to me) or should I investigate these Getter Setters some more? Here's what I am doing right now:
public class Boxer : MonoBehaviour {
// generic boxer details:
int id;
string nameA, nameB;
int weight;
int height;
float age;
float reach;
// career info:
int wins, loses, draws, winsByKO;
// boxing attributes/stats:
float power, speed, agility, koPunch, stamina, toughness;
public int GetId()
{
return id;
}
public string GetNameA()
{
return nameA;
}
public string GetNameB()
{
return nameB;
}
}