I’m trying to use extensions for the first time in unity and I’m a bit confused on the implementation.
I have
public class Stats : MonoBehaviour{
public int intelligence;
public int agility;
public int strength;
public int health;
public int damage;
public int speed;
public Stats()
{
intelligence = 0;
agility = 0;
strength = 0;
health = 0;
damage = 0;
speed = 0;
}
public int getIntelligence()
{
return intelligence;
}
public int getAgility()
{
return agility;
}
public int getStrength()
{
return strength;
}
public int getHealth()
{
return health;
}
public int getDamage()
{
return damage;
}
public int getSpeed()
{
return speed;
}
and in another script I have
public class Creature : Stats {
void Start () {
intelligence = getIntelligence();
strength = getStrength();
agility = getAgility();
health = getHealth();
damage = getDamage();
speed = getSpeed();
}
I have set the “Stats” in the inspector to all be 1 so I can see them change from 0 to 1 however this doesn’t work. Is this now how you do this? I feel like I’m not understanding the proper way to implement this. Could someone explain?
Thank you!