Add parameters to Event Delegates
This commit is contained in:
parent
addeb47c04
commit
686294ab41
|
@ -17,14 +17,15 @@ void UEXPComponent::IncrementEXP(int value)
|
|||
{
|
||||
// TODO: I should be updating the level here
|
||||
CurrentEXP += value;
|
||||
OnEXPGained.ExecuteIfBound();
|
||||
OnEXPGained.ExecuteIfBound(value);
|
||||
OnEXPLevelUp.ExecuteIfBound(CurrentLevel);
|
||||
}
|
||||
|
||||
void UEXPComponent::SetCurrentEXP(int value)
|
||||
{
|
||||
// TODO: I should be updating the level here
|
||||
CurrentEXP = value;
|
||||
OnEXPGained.ExecuteIfBound();
|
||||
OnEXPGained.ExecuteIfBound(value);
|
||||
}
|
||||
|
||||
int UEXPComponent::GetCurrentEXP()
|
||||
|
@ -41,6 +42,8 @@ void UEXPComponent::Reset()
|
|||
{
|
||||
CurrentEXP = 0;
|
||||
CurrentLevel = 0;
|
||||
OnEXPGained.ExecuteIfBound(CurrentEXP);
|
||||
OnEXPLevelUp.ExecuteIfBound(CurrentLevel);
|
||||
}
|
||||
|
||||
// Called when the game starts
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include "Components/ActorComponent.h"
|
||||
#include "EXPComponent.generated.h"
|
||||
|
||||
DECLARE_DELEGATE(FOnEXPGainedDelegate)
|
||||
DECLARE_DELEGATE(FOnEXPLevelUpDelegate)
|
||||
DECLARE_DELEGATE_OneParam(FOnEXPGainedDelegate, int)
|
||||
DECLARE_DELEGATE_OneParam(FOnEXPLevelUpDelegate, int)
|
||||
|
||||
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
||||
class VAMPIRES_API UEXPComponent : public UActorComponent
|
||||
|
|
Loading…
Reference in New Issue