- Bonus 5% xp per rep level - Relative power level values and respective ranks (E-S+) - small bugfix on ability/class unlock info message - added less bright light when class is unlocked on character creation screen - Removed base slashes of other classes from the human possible builds - New human class specific autocast ability "Sword Art" - New knight ability "shining light"
85 lines
2.8 KiB
C#
85 lines
2.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
[System.Serializable]
|
|
public class Level
|
|
{
|
|
public int currentLevel;
|
|
|
|
public UnityEvent OnLevelUpEvent = new UnityEvent();
|
|
public UnityEvent OnExperienceChanged = new UnityEvent();
|
|
|
|
protected float currentExperience;
|
|
public float GetCurrentExperience()
|
|
{
|
|
return currentExperience;
|
|
}
|
|
|
|
public float FinalExperienceThreshold;
|
|
|
|
public Level()
|
|
{
|
|
currentLevel = 1;
|
|
currentExperience = 0f;
|
|
//baseExperienceThreshold = 500f;
|
|
OnLevelUpEvent.AddListener(UpdateExperienceThreshold);
|
|
UpdateExperienceThreshold();
|
|
}
|
|
public Level(int currentLevel, float currentExperience)
|
|
{
|
|
this.currentLevel = currentLevel;
|
|
this.currentExperience = currentExperience;
|
|
|
|
OnLevelUpEvent.AddListener(UpdateExperienceThreshold);
|
|
UpdateExperienceThreshold();
|
|
}
|
|
|
|
public void GainExperience(float xpIncome)
|
|
{
|
|
currentExperience += xpIncome * (1 + GameConstants.GameBalancing.ReputationLevelIntoIncreasedExperienceMultiplier * PlayerDataHandler.Instance.LoadPlayerAccountData(PlayerDataHandler.Instance.currentPlayerName.Value).currentReputationLevel);
|
|
if (currentExperience >= FinalExperienceThreshold)
|
|
{
|
|
currentExperience -= FinalExperienceThreshold;
|
|
currentLevel++;
|
|
OnLevelUpEvent.Invoke();
|
|
//Debug.Log("LevelUp Event Trigger");
|
|
}
|
|
//Debug.Log(xpIncome + " exp received");
|
|
//Debug.Log(currentExperience + " / " + FinalExperienceThreshold);
|
|
if (currentExperience >= FinalExperienceThreshold)
|
|
{
|
|
GainExperience(0);
|
|
}
|
|
OnExperienceChanged.Invoke();
|
|
}
|
|
|
|
public virtual void UpdateExperienceThreshold()
|
|
{
|
|
FinalExperienceThreshold = Mathf.RoundToInt(GameConstants.CharacterBalancing.BaseExperienceThreshold + GameConstants.CharacterBalancing.ExperienceThresholdGrowth * Mathf.Pow((float)currentLevel, GameConstants.CharacterBalancing.ExperienceThresholdGrowthPerLevelExponent));
|
|
}
|
|
|
|
}
|
|
|
|
|
|
[System.Serializable]
|
|
public class ReputationLevel : Level
|
|
{
|
|
public ReputationLevel() : base()
|
|
{
|
|
currentLevel = 0;
|
|
currentExperience = 0f;
|
|
}
|
|
|
|
public ReputationLevel(int currentLevel, float currentExperience) : base(currentLevel, currentExperience)
|
|
{
|
|
this.currentLevel = currentLevel;
|
|
this.currentExperience = currentExperience;
|
|
}
|
|
|
|
public override void UpdateExperienceThreshold()
|
|
{
|
|
FinalExperienceThreshold = Mathf.RoundToInt(GameConstants.CharacterBalancing.BaseReputationExperienceThreshold + GameConstants.CharacterBalancing.ReputationExperienceThresholdGrowth * Mathf.Pow((float)currentLevel, GameConstants.CharacterBalancing.ReputationExperienceThresholdGrowthPerLevelExponent));
|
|
}
|
|
} |