[박치영] 포션작업 완료
parent
29d650d432
commit
1c73b094ff
|
@ -155,4 +155,5 @@ ManualIPAddress=
|
||||||
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.EquippedItems",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipments")
|
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.EquippedItems",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipments")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.BaseConsumable.NumberOfUses",NewName="/Script/D1.BaseConsumable.CurrentNumberOfUses")
|
+PropertyRedirects=(OldName="/Script/D1.BaseConsumable.NumberOfUses",NewName="/Script/D1.BaseConsumable.CurrentNumberOfUses")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.BaseConsumable.NumberOfUses",NewName="/Script/D1.BaseConsumable.CurrentNumberOfUses")
|
+PropertyRedirects=(OldName="/Script/D1.BaseConsumable.NumberOfUses",NewName="/Script/D1.BaseConsumable.CurrentNumberOfUses")
|
||||||
|
+PropertyRedirects=(OldName="/Script/D1.BaseConsumable.Value",NewName="/Script/D1.BaseConsumable.ModificationValue")
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "Actor/BaseConsumable.h"
|
#include "Actor/BaseConsumable.h"
|
||||||
|
|
||||||
|
#include "Components/StatsComponent.h"
|
||||||
#include "Interface/CombatInterface.h"
|
#include "Interface/CombatInterface.h"
|
||||||
|
|
||||||
ABaseConsumable::ABaseConsumable()
|
ABaseConsumable::ABaseConsumable()
|
||||||
|
@ -15,7 +16,7 @@ ABaseConsumable::ABaseConsumable()
|
||||||
OwnedGameplayTags.AddTag(FCombatGameplayTags::Get().Item_Consumable_Potion);
|
OwnedGameplayTags.AddTag(FCombatGameplayTags::Get().Item_Consumable_Potion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABaseConsumable::UseItem()
|
void ABaseConsumable::PerformItemAction()
|
||||||
{
|
{
|
||||||
if(CurrentNumberOfUses <= 0)
|
if(CurrentNumberOfUses <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -25,9 +26,15 @@ void ABaseConsumable::UseItem()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActionObjects->PerformCustomAction(FCombatGameplayTags::Get().Character_Action_Attack_UseItem, FCombatGameplayTags::Get().Character_State_GeneralActionState, UseItemMontage);
|
ActionObjects->PerformCustomAction(FCombatGameplayTags::Get().Character_Action_Attack_UseItem, FCombatGameplayTags::Get().Character_State_GeneralActionState, UseItemMontage);
|
||||||
CurrentNumberOfUses--;
|
}
|
||||||
|
|
||||||
|
void ABaseConsumable::ConsumeItem()
|
||||||
|
{
|
||||||
|
CurrentNumberOfUses--;
|
||||||
OnConsumeUpdated.Broadcast(GetNumberOfConsumable());
|
OnConsumeUpdated.Broadcast(GetNumberOfConsumable());
|
||||||
|
|
||||||
|
if (UStatsComponent* StatComponent = GetOwner()->GetComponentByClass<UStatsComponent>())
|
||||||
|
StatComponent->ModifyCurrentStatValue(StatType, ModificationValue, ShouldRegenerate);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 ABaseConsumable::GetNumberOfConsumable()
|
int32 ABaseConsumable::GetNumberOfConsumable()
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Actor/BaseEquippable.h"
|
#include "Actor/BaseEquippable.h"
|
||||||
|
#include "Components/StatsComponent.h"
|
||||||
#include "BaseConsumable.generated.h"
|
#include "BaseConsumable.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +19,10 @@ class D1_API ABaseConsumable : public ABaseEquippable
|
||||||
public:
|
public:
|
||||||
ABaseConsumable();
|
ABaseConsumable();
|
||||||
public:
|
public:
|
||||||
virtual void UseItem() override;
|
virtual void PerformItemAction() override;
|
||||||
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void ConsumeItem();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int32 GetNumberOfConsumable();
|
int32 GetNumberOfConsumable();
|
||||||
|
@ -29,8 +33,15 @@ private:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||||
TObjectPtr<UAnimMontage> UseItemMontage;
|
TObjectPtr<UAnimMontage> UseItemMontage;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
//Blueprint에서 입력
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Consumable Stat Modification", meta = (AllowPrivateAccess = "true"))
|
||||||
int32 CurrentNumberOfUses;
|
int32 CurrentNumberOfUses;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Consumable Stat Modification", meta = (AllowPrivateAccess = "true"))
|
||||||
int32 MaxNumberOfUses;
|
int32 MaxNumberOfUses;
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Consumable Stat Modification", meta = (AllowPrivateAccess = "true"))
|
||||||
|
EStats StatType;
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Consumable Stat Modification", meta = (AllowPrivateAccess = "true"))
|
||||||
|
float ModificationValue;
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Consumable Stat Modification", meta = (AllowPrivateAccess = "true"))
|
||||||
|
bool ShouldRegenerate;
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,7 +61,7 @@ bool ABaseEquippable::GetIsEquipped()
|
||||||
return bIsEquipped;
|
return bIsEquipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABaseEquippable::UseItem()
|
void ABaseEquippable::PerformItemAction()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
virtual void OnUnequipped();
|
virtual void OnUnequipped();
|
||||||
virtual void SetIsEquipped(bool IsEquipped);
|
virtual void SetIsEquipped(bool IsEquipped);
|
||||||
virtual bool GetIsEquipped();
|
virtual bool GetIsEquipped();
|
||||||
virtual void UseItem();
|
virtual void PerformItemAction();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Inherited via IGameplayTagAssetInterface
|
// Inherited via IGameplayTagAssetInterface
|
||||||
|
|
|
@ -411,7 +411,7 @@ bool ACombatPlayerCharacter::UseItemByTag(FGameplayTag ItemTag)
|
||||||
continue;
|
continue;
|
||||||
if(TagItem->HasMatchingGameplayTag(ItemTag))
|
if(TagItem->HasMatchingGameplayTag(ItemTag))
|
||||||
{
|
{
|
||||||
Item->UseItem();
|
Item->PerformItemAction();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1098,4 +1098,20 @@ bool ACombatPlayerCharacter::WasHitBlocked()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ABaseEquippable* ACombatPlayerCharacter::GetEquippedItemByTag(FGameplayTag itemTag)
|
||||||
|
{
|
||||||
|
for (auto Item : EquippedItems)
|
||||||
|
{
|
||||||
|
if(IsValid(Item))
|
||||||
|
{
|
||||||
|
IGameplayTagAssetInterface* TagItem = Cast<IGameplayTagAssetInterface>(Item);
|
||||||
|
if(!TagItem)
|
||||||
|
continue;
|
||||||
|
if(TagItem->HasMatchingGameplayTag(itemTag))
|
||||||
|
return Item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "Definitions/GameEnums.h"
|
#include "Definitions/GameEnums.h"
|
||||||
#include "CombatPlayerCharacter.generated.h"
|
#include "CombatPlayerCharacter.generated.h"
|
||||||
|
|
||||||
|
|
||||||
class UInputMappingContext;
|
class UInputMappingContext;
|
||||||
class UInputAction;
|
class UInputAction;
|
||||||
|
|
||||||
|
@ -205,6 +204,9 @@ protected: //Check Func
|
||||||
FGameplayTag GetDesiredAttackType();
|
FGameplayTag GetDesiredAttackType();
|
||||||
bool WasHitBlocked();
|
bool WasHitBlocked();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
class ABaseEquippable* GetEquippedItemByTag(FGameplayTag itemTag);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true"))
|
||||||
TObjectPtr<class UCombatComponent> CombatComponent;
|
TObjectPtr<class UCombatComponent> CombatComponent;
|
||||||
|
|
|
@ -58,7 +58,7 @@ void UStatsComponent::ModifyCurrentStatValue(EStats stat, float value, bool bSho
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float currentValue = GetCurrentStatValue(stat) + value;
|
float currentValue = GetCurrentStatValue(stat) + value;
|
||||||
currentValue = FMath::Clamp(currentValue, 0.f, currentValue);
|
currentValue = FMath::Clamp(currentValue, 0.f, GetMaxStatValue(stat));
|
||||||
SetCurrentStatValue(stat, currentValue);
|
SetCurrentStatValue(stat, currentValue);
|
||||||
|
|
||||||
if (bShouldRegenerate)
|
if (bShouldRegenerate)
|
||||||
|
|
Loading…
Reference in New Issue