Experience system for multiple skills

Hello,

I'm currently working on a demo for an RPG.

We will have a lot of skills (Could be up to 100). I have the basic functionality of 1 skill (checking if your exp is high enough to level, etc.)

Now, how do I go about implementing this for a lot of skills?

  • Just making a script for every skills that inherits from the base script?
  • Give the player the variables for every skill and call the other scripts to check for level-ups?
  • Something else?

What I have now is:

public class BaseSkills{

private int _baseLevel;         //Level of the skill
private int _curExp;            //Current exp
private int _expToLevel;        //Total experience for the next level
private int _levelModifier;     //Determines the experience needed for the next level

public BaseSkills()
{
    _baseLevel = 1;
    _expToLevel = 100;
    _levelModifier = 1;
}

#region Setters and Getters
//Setters and getters
public int BaseLevel
{
    get{ return _baseLevel; }
    set{ _baseLevel = value; }
}

public int CurExp
{
    get{ return _curExp;}
    set{ _curExp = value;}
}

public int ExpToLevel
{
    get{ return _expToLevel; }
    set{ _expToLevel = value; }
}

public int LevelModifier
{
    get{ return _levelModifier; }
    set{ _levelModifier = value; }
}
#endregion

private int CalculateExpToLevel()
{
    #region Experience if-statements
                                            //These if-statements calculate how much
                                            //experience needs to be added to
    if (ExpToLevel < 1000)                  //ExpToLevel.
        {
            LevelModifier = 100;
        }
    if (ExpToLevel < 6000)
        {
            LevelModifier = 500;
        }
    if (ExpToLevel < 16000)
        {
            LevelModifier = 1000;
        }
    if (ExpToLevel < 36000)
        {
            LevelModifier = 2000;
        }
    if (ExpToLevel < 66000)
        {
            LevelModifier = 3000;
        }
    if (ExpToLevel < 106000)
        {
            LevelModifier = 4000;
        }
    if (ExpToLevel < 156000)
        {
            LevelModifier = 5000;
        }
    if (ExpToLevel < 256000)
        {
            LevelModifier = 10000;
        }
    if (ExpToLevel < 406000)
        {
            LevelModifier = 15000;
        }
    if (ExpToLevel < 606000)
        {
            LevelModifier = 20000;
        }
    #endregion

    return _expToLevel + _levelModifier;
}

public void LevelUp()
{
    if (CurExp > ExpToLevel);
        BaseLevel++;
}

}

Thanks in advance! Regards,

Simon.

P.S. I'm using C# in MonoDevelop.

I understand now. You basically answered your own question. I would have your skills inherit from the base skill class in order to use the common functions.

This seems like the most sensible way to do it.