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