Skip to content

Commit

Permalink
Upgrade Window
Browse files Browse the repository at this point in the history
  • Loading branch information
Courtshipfy committed Jun 30, 2023
1 parent e11043e commit 020a723
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
Binary file modified Content/BP_VPTD_GameMode.uasset
Binary file not shown.
Binary file modified Content/Blueprint/Widgets_BP/Attributes_Widget.uasset
Binary file not shown.
Binary file modified Content/Blueprint/Widgets_BP/Upgrade_Widget.uasset
Binary file not shown.
Binary file modified Content/Level/Test.umap
Binary file not shown.
16 changes: 15 additions & 1 deletion Source/Project_VSTD/Private/VPTD_AttributeComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ bool UVPTD_AttributeComponent::ApplyChangeHealth(AActor* Instigator, float Delta
bool UVPTD_AttributeComponent::ApplyChangeEXP(AActor* InstigatorActor,int32 Delta)
{
TotalEXP += Delta;
Level = TotalEXP / PerLevelEXP;
int32 NewLevel = TotalEXP / PerLevelEXP;
if(NewLevel > Level)
{
ApplyChangeLevel(GetOwner(),NewLevel - Level);
}


OnExpChangedDelegated.Broadcast(InstigatorActor,nullptr,Delta);

Expand All @@ -83,3 +88,12 @@ bool UVPTD_AttributeComponent::ApplyChangeMoney(AActor* InstigatorActor, int32 D
return true;
}

bool UVPTD_AttributeComponent::ApplyChangeLevel(AActor* InstigatorActor, int32 Delta)
{
Level += Delta;

OnLevelChangedDelegated.Broadcast(InstigatorActor,nullptr,Delta);

return true;
}

8 changes: 8 additions & 0 deletions Source/Project_VSTD/Public/VPTD_AttributeComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnEXPChanged,AActor*,InstigatorA

DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnMoneyChanged,AActor*,InstigatorActor,UVPTD_AttributeComponent*,OwningComp,int32,MewMoney,int32,Delta);

DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnLevelChanged,AActor*,InstigatorActor,UVPTD_AttributeComponent*,OwningComp,int32,Delta);

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class PROJECT_VSTD_API UVPTD_AttributeComponent : public UActorComponent
{
Expand Down Expand Up @@ -57,6 +59,9 @@ class PROJECT_VSTD_API UVPTD_AttributeComponent : public UActorComponent
UPROPERTY(BlueprintAssignable)
FOnMoneyChanged OnMoneyChangedDelegated;

UPROPERTY(BlueprintAssignable)
FOnLevelChanged OnLevelChangedDelegated;

UFUNCTION(BlueprintCallable)
bool ApplyChangeHealth(AActor*Instigator,float Delta);

Expand All @@ -66,6 +71,9 @@ class PROJECT_VSTD_API UVPTD_AttributeComponent : public UActorComponent
UFUNCTION(BlueprintCallable)
bool ApplyChangeMoney(AActor* InstigatorActor,int32 Delta);

UFUNCTION(BlueprintCallable)
bool ApplyChangeLevel(AActor* InstigatorActor,int32 Delta = 1);


public:

Expand Down

0 comments on commit 020a723

Please sign in to comment.