Unity Levelup Script

I am using unity community levelup script. Don’t know how to rewrite a script. Trying to understand how this script well work for what I want.
Lets say theres 20 levels would I need to repeat the code for each level?
GainExp would I change that to Dying Enemy, so whenever the player kills an enemy they get exp from that?
Whats Jump for?

For the leveling Methods not sure which one to use or understand them?
hope someone can explain it to me.

using UnityEngine;
using System.Collections;
public class Experience : MonoBehaviour
{
    //current level
    public int vLevel = 1;
    //current exp amount
    public int vCurrExp = 0;
    //exp amount needed for lvl 1
    public int vExpBase = 10;
    //exp amount left to next levelup
    public int vExpLeft = 10;
    //modifier that increases needed exp each level
    public float vExpMod = 1.15f;
    //vvvvvv USED FOR TESTING FEEL FREE TO DELETE
    void Update ()
    {
        if (Input.GetButtonDown("Jump"))
        {
            GainExp(3);
        }
    }
    //^^^^^^ USED FOR TESTING FEEL FREE TO DELETE
    //leveling methods
    public void GainExp(int e)
    {
        vCurrExp += e;
        if(vCurrExp >= vExpLeft)
        {
            LvlUp();
        }
    }
    void LvlUp()
    {
        vCurrExp -= vExpLeft;
        vLevel++;
        float t = Mathf.Pow(vExpMod, vLevel);
        vExpLeft = (int)Mathf.Floor(vExpBase * t);
    }
}

It looks like an example script where each time you press the “Jump” button it adds 3 experience so you can pound on the Jump button and watch the experience and levels go up. You’ll need to replace the Jump button nonsense with whatever you actually want to trigger adding experience.

So to add experience you just need to call GainExp and pass it the number of experience. Your player kills a monster, in whatever function you call to kill the monster you have it call GainExp and pass the amount of experience. The script automatically handles increasing levels. You adjust how much experience is needed for new levels by modifying the vExpBase, vExpLeft (which probably just needs to start at the same value as vExpBase), and vExpMod which looks like a multiplier to make higher levels take more exp than lower levels.

The script doesn’t appear to implement a level or experience cap, other than of course the max value of the integer type. In your question about 20 levels, you’re being ambiguous whether you’re talking about levels in the context of this script, or levels in the context of game levels (different scenes, etc). But no, in either case you’d just use the same script unless you had a good reason to reimplement the system entirely differently in another context (doubtful).