Exemple #1
0
 void Start()
 {
     OnXPGain  += ExpSystem_OnXPGain;
     lvlexpneed = new List <int> {
         50, 400, 5000, 20000, 70000, 100000
     };
     LvlText.text = currentlvl.ToString();
     OnXPGain?.Invoke(this, EventArgs.Empty);
 }
Exemple #2
0
 public void GainExp(float amount)
 {
     currentExp += (int)amount;
     for (int i = 0; currentExp > lvlexpneed[currentlvl]; i++)
     {
         if (currentExp >= lvlexpneed[currentlvl])
         {
             currentExp -= lvlexpneed[currentlvl];
             LvlUp(1);
             OnLvlUp(this, EventArgs.Empty);
         }
     }
     OnXPGain?.Invoke(this, EventArgs.Empty);
     icon.fillAmount = (float)currentExp / lvlexpneed[currentlvl];
 }
    private void OnItemTapped(TapReactionItem item, TapReactionState state)
    {
        switch (state)
        {
        case TapReactionState.Early:
            OnXPGain?.Invoke(gainedXPPerFailedItem);
            itemsEarly++;
            break;

        case TapReactionState.Correct:
            OnXPGain?.Invoke(gainedXPPerCorrectItem);
            itemsCorrect++;
            break;

        case TapReactionState.Late:
            OnXPGain?.Invoke(gainedXPPerFailedItem);
            itemsLate++;
            break;
        }
        item.OnTapped -= OnItemTapped;
    }