Example #1
0
    public void UpdateLevel()
    {
        levelProgress += levelProgressPerSecond * levelProgressMultiplier;

        if (levelProgress >= 1)
        {
            level++;
            LeveledUp?.Invoke(level);
            // levelProgressMultiplier = 50 / level;
            levelProgress = 0;
        }
    }
Example #2
0
        public void AddExperience(int exp)
        {
            Experience += exp;
            CurrentGame.Journal.Write(new ExperienceGainedMessage(exp));

            var xpToLevelUp = GetXpToLevelUp();

            if (Experience >= xpToLevelUp)
            {
                Log.Debug($"Leveled Up. EXP: {Experience}, EXP to LVL: {GetXpToLevelUp()}");
                Level++;
                Experience -= xpToLevelUp;
                CurrentGame.Journal.Write(new LevelUpMessage(Level));
                LeveledUp?.Invoke(this, EventArgs.Empty);
            }
        }
Example #3
0
 private void OnLeveledUp()
 {
     LeveledUp?.Invoke(this);
 }
 private void LeveledUpHandler(object sender, PokemonEventArgs e)
 {
     LeveledUp?.Invoke(this, EventArgs);
 }
Example #5
0
 internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
 {
     LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
 }