public static void InitializeThis(int requiredForLevelExperience, float changingExpCoeff) { RequiredForLevelExperience = requiredForLevelExperience; ChangingExpCoeff = changingExpCoeff; int requiredForNextLevelExperience = Mathf.RoundToInt(RequiredForLevelExperience * Mathf.Pow(ChangingExpCoeff, CurrentLevel - 1)); OnChangeExp?.Invoke(AmountOfExperience, requiredForNextLevelExperience); OnIncreaseLevel?.Invoke(CurrentLevel); }
public static void ToChangeAmountOfExp(int changeNumber) { AmountOfExperience += changeNumber; int requiredForNextLevelExperience = Mathf.RoundToInt(RequiredForLevelExperience * Mathf.Pow(ChangingExpCoeff, CurrentLevel - 1)); if (AmountOfExperience >= requiredForNextLevelExperience) { AmountOfExperience -= requiredForNextLevelExperience; requiredForNextLevelExperience = Mathf.RoundToInt(RequiredForLevelExperience * Mathf.Pow(ChangingExpCoeff, CurrentLevel - 1)); IncreaseLevel(); } OnChangeExp?.Invoke(AmountOfExperience, requiredForNextLevelExperience); }