Compare commits
No commits in common. "1bc85f970aa5a2a25480a7aef82e4a96df01cd28" and "079fba5d8b24bd6f43e242619d25f8c00ad8fb50" have entirely different histories.
1bc85f970a
...
079fba5d8b
BIN
Content/Widgets/HUD/BP_HUDWidget.uasset (Stored with Git LFS)
BIN
Content/Widgets/HUD/BP_HUDWidget.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -15,35 +15,17 @@ UEXPComponent::UEXPComponent()
|
||||||
|
|
||||||
void UEXPComponent::IncrementEXP(int value)
|
void UEXPComponent::IncrementEXP(int value)
|
||||||
{
|
{
|
||||||
int oldEXP = CurrentEXP;
|
// TODO: I should be updating the level here
|
||||||
int oldLevel = CurrentLevel;
|
|
||||||
|
|
||||||
CurrentEXP += value;
|
CurrentEXP += value;
|
||||||
OnEXPGained.ExecuteIfBound(value);
|
OnEXPGained.ExecuteIfBound(value);
|
||||||
|
|
||||||
CurrentLevel = FMath::Floor(CurrentEXP / 100.0f);
|
|
||||||
|
|
||||||
if (CurrentLevel != oldLevel)
|
|
||||||
{
|
|
||||||
OnEXPLevelUp.ExecuteIfBound(CurrentLevel);
|
OnEXPLevelUp.ExecuteIfBound(CurrentLevel);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UEXPComponent::SetCurrentEXP(int value)
|
void UEXPComponent::SetCurrentEXP(int value)
|
||||||
{
|
{
|
||||||
int oldEXP = CurrentEXP;
|
|
||||||
int oldLevel = CurrentLevel;
|
|
||||||
|
|
||||||
// TODO: I should be updating the level here
|
// TODO: I should be updating the level here
|
||||||
CurrentEXP = value;
|
CurrentEXP = value;
|
||||||
OnEXPGained.ExecuteIfBound(value);
|
OnEXPGained.ExecuteIfBound(value);
|
||||||
|
|
||||||
CurrentLevel = FMath::Floor(CurrentEXP / 100.0f);
|
|
||||||
|
|
||||||
if (CurrentLevel != oldLevel)
|
|
||||||
{
|
|
||||||
OnEXPLevelUp.ExecuteIfBound(CurrentLevel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int UEXPComponent::GetCurrentEXP()
|
int UEXPComponent::GetCurrentEXP()
|
||||||
|
@ -64,11 +46,6 @@ void UEXPComponent::Reset()
|
||||||
OnEXPLevelUp.ExecuteIfBound(CurrentLevel);
|
OnEXPLevelUp.ExecuteIfBound(CurrentLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
float UEXPComponent::GetCurrentLevelPercent()
|
|
||||||
{
|
|
||||||
return (CurrentEXP % 100) / 100.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
void UEXPComponent::BeginPlay()
|
void UEXPComponent::BeginPlay()
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,9 +42,6 @@ public:
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, BlueprintPure)
|
|
||||||
float GetCurrentLevelPercent();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
Loading…
Reference in New Issue