[박치영] 포션 개수제한 기능 추가
parent
0ab073bd22
commit
1bc4df3e52
|
@ -153,4 +153,6 @@ ManualIPAddress=
|
|||
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.Weapon",NewName="/Script/D1.CombatPlayerCharacter.StartingEquipment")
|
||||
+PropertyRedirects=(OldName="/Script/D1.CombatPlayerCharacter.StartingEquipment",NewName="/Script/D1.CombatPlayerCharacter.EquippedItems")
|
||||
+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")
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -7,15 +7,23 @@
|
|||
|
||||
ABaseConsumable::ABaseConsumable()
|
||||
{
|
||||
//초기화 구문
|
||||
MaxNumberOfUses = 3;
|
||||
CurrentNumberOfUses = 0;
|
||||
|
||||
//Settings OwnedGameplayTags
|
||||
OwnedGameplayTags.AddTag(FCombatGameplayTags::Get().Item_Consumable_Potion);
|
||||
}
|
||||
|
||||
void ABaseConsumable::UseItem()
|
||||
{
|
||||
if(MaxNumberOfUses < CurrentNumberOfUses)
|
||||
return;
|
||||
|
||||
ICombatInterface* ActionObjects = Cast<ICombatInterface>(GetOwner());
|
||||
if(!ActionObjects)
|
||||
return;
|
||||
|
||||
ActionObjects->PerformCustomAction(FCombatGameplayTags::Get().Character_Action_Attack_UseItem, FCombatGameplayTags::Get().Character_State_GeneralActionState, UseItemMontage);
|
||||
CurrentNumberOfUses++;
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public:
|
|||
private:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<UAnimMontage> UseItemMontage;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||
int32 CurrentNumberOfUses;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage", meta = (AllowPrivateAccess = "true"))
|
||||
int32 MaxNumberOfUses;
|
||||
};
|
||||
|
|
|
@ -605,6 +605,7 @@ void ACombatPlayerCharacter::StopBlocking(const FInputActionValue& Value)
|
|||
|
||||
void ACombatPlayerCharacter::UseItem(const FInputActionValue& Value)
|
||||
{
|
||||
if(CanUseItem())
|
||||
UseItemByTag(FCombatGameplayTags::Get().Item_Consumable);
|
||||
}
|
||||
|
||||
|
@ -1042,6 +1043,23 @@ bool ACombatPlayerCharacter::CanPerformBlock()
|
|||
return ReturnValue;
|
||||
}
|
||||
|
||||
bool ACombatPlayerCharacter::CanUseItem()
|
||||
{
|
||||
bool ReturnValue = true;
|
||||
|
||||
FGameplayTagContainer inputContainer;
|
||||
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Attacking);
|
||||
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Dodging);
|
||||
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Dead);
|
||||
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Disable);
|
||||
inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_GeneralActionState);
|
||||
|
||||
ReturnValue &= !StateManagerComponent->IsCurrentStateEqualToAny(inputContainer);
|
||||
ReturnValue &= (StatsComponent->GetCurrentStatValue(EStats::Stamina) >= 10.f);
|
||||
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
FGameplayTag ACombatPlayerCharacter::GetDesiredAttackType()
|
||||
{
|
||||
if (GetCharacterMovement()->IsFalling())
|
||||
|
|
|
@ -200,6 +200,7 @@ protected: //Check Func
|
|||
bool CanReceiveHitReaction();
|
||||
bool CanPerformSprint();
|
||||
bool CanPerformBlock();
|
||||
bool CanUseItem();
|
||||
FGameplayTag GetDesiredAttackType();
|
||||
bool WasHitBlocked();
|
||||
|
||||
|
|
|
@ -20,3 +20,9 @@ void ACombatHUD::BeginPlay()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ACombatHUD::UpdateHealthPotionAmount()
|
||||
{
|
||||
if(!IsValid(MainUI))
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ class D1_API ACombatHUD : public AHUD
|
|||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
public:
|
||||
void UpdateHealthPotionAmount();
|
||||
private:
|
||||
UPROPERTY(EditDefaultsOnly, Category = UI)
|
||||
TSubclassOf<class UUI_MainHUD> MainUI;
|
||||
|
|
Loading…
Reference in New Issue