Quick SetCurrentEXP update
This commit is contained in:
parent
5fac9c7f73
commit
937e61db7f
@ -61,11 +61,26 @@ void UEXPComponent::SetCurrentEXP(int value)
|
|||||||
int oldEXP = CurrentEXP;
|
int oldEXP = CurrentEXP;
|
||||||
int oldLevel = CurrentLevel;
|
int oldLevel = CurrentLevel;
|
||||||
|
|
||||||
// TODO: I should be updating the level here
|
|
||||||
CurrentEXP = value;
|
CurrentEXP = value;
|
||||||
|
|
||||||
|
NextLevelRow = FExpTableRow();
|
||||||
|
|
||||||
|
while (CurrentEXP < NextLevelRow.CumulativeExpForPreviousLevel && CurrentEXP < NextLevelRow.CumulativeExpForNextLevel)
|
||||||
|
{
|
||||||
|
if (FExpTableRow* newRow = LevelsTable->FindRow<FExpTableRow>(FName(*FString::FromInt(NextLevelRow.Level + 1)),"", true))
|
||||||
|
{
|
||||||
|
NextLevelRow = *newRow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NextLevelRow.Level++;
|
||||||
|
NextLevelRow.CumulativeExpForPreviousLevel = NextLevelRow.CumulativeExpForNextLevel;
|
||||||
|
NextLevelRow.ExpRequiredForNextLevel += 16;
|
||||||
|
NextLevelRow.CumulativeExpForNextLevel += NextLevelRow.ExpRequiredForNextLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnEXPGained.Broadcast(CurrentEXP, GetCurrentLevelPercent());
|
OnEXPGained.Broadcast(CurrentEXP, GetCurrentLevelPercent());
|
||||||
|
|
||||||
CurrentLevel = FMath::Floor(CurrentEXP / 100.0f);
|
|
||||||
|
|
||||||
if (CurrentLevel != oldLevel)
|
if (CurrentLevel != oldLevel)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user